block delet

This commit is contained in:
2024-08-18 18:37:32 -07:00
parent 799c7a2a55
commit 8ec9138b51
2 changed files with 33 additions and 16 deletions

View File

@ -22,6 +22,14 @@ public struct Chunk {
}
mutating func setBlockInternally(at position: SIMD3<Int>, type: BlockType) {
if position.x >= Chunk.chunkSize || position.y >= Chunk.chunkSize || position.z >= Chunk.chunkSize {
return
}
if position.x < 0 || position.y < 0 || position.z < 0 {
return
}
blocks[position.x + position.y * Chunk.chunkSize + position.z * Chunk.chunkSize * Chunk.chunkSize].type = type
}