Skip to content

Commit

Permalink
Readd math.floor conversions in chunk.setVoxel and SetVoxelDataInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin452 committed Mar 24, 2024
1 parent 82facb5 commit 7a3a7f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/world/chunks/chunkmain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function NewChunk(x, z)
@return Nothing.
--]]
chunk.setVoxel = function(self, x, y, z, blockvalue, manuallyPlaced)
x, y, z = math.floor(x), math.floor(y), math.floor(z)
SetVoxelInternal(manuallyPlaced, self, x, y, z, blockvalue)
end
chunk.setVoxelData = function(self, x, y, z, blockvalue)
Expand Down
1 change: 1 addition & 0 deletions src/world/chunks/chunkutils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function UpdateVoxelData(self, blockvalue, x, y, z)
self.changes[#self.changes + 1] = { x, y, z }
end
function SetVoxelDataInternal(self, x, y, z, blockvalue, dataIndex)
x, y, z = math.floor(x), math.floor(y), math.floor(z)
if x <= ChunkSize and x >= 1 and z <= ChunkSize and z >= 1 and y >= 1 and y <= WorldHeight then
local dataIndexOffset = (dataIndex == "First" and 2 or 3)
self.voxels[x][z] =
Expand Down

0 comments on commit 7a3a7f1

Please sign in to comment.