fix chunk sections being one

This commit is contained in:
adman
2026-04-20 20:23:25 +02:00
parent c83a777eac
commit 997594d7c3
+10 -2
View File
@@ -37,8 +37,16 @@ func (cb *ChunkBuilder) FillAllById(block, biome int32) {
cb.Blocks = make([][]int32, numSections)
cb.Biomes = make([][]int32, numSections)
for i := range cb.Blocks {
cb.Blocks[i] = blockSection
cb.Biomes[i] = biomeSection
// Otherwise setting one block will set it also in all other sections because the slice is the same
var blocks = make([]int32, BlocksPerChunkSection)
copy(blocks, blockSection)
var biomes = make([]int32, BiomesPerChunkSection)
copy(biomes, biomeSection)
cb.Blocks[i] = blocks
cb.Biomes[i] = biomes
}
return
}