improve chunk section palette handling for blocks

This commit is contained in:
adman
2026-05-09 16:34:31 +02:00
parent 477f51cce7
commit c800c5d471
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -44,11 +44,17 @@ func (c Chunk) ToStorage(version string) (toChunk *level.Chunk, err error) {
}
toChunk.Sections[i].BlockCount = int16(level.BlocksPerChunkSection - level.CountStorage(toChunk.Sections[i].Blocks, 0))
} else {
toChunk.Sections[i].Blocks, err = f.FullWith(0) //TODO PALLETE index 0 if avial
var fillerId = int32(0)
if len(pallete) == 1 {
fillerId = pallete[0]
if fillerId != 0 {
toChunk.Sections[i].BlockCount = level.BlocksPerChunkSection
}
}
toChunk.Sections[i].Blocks, err = f.FullWith(fillerId)
if err != nil {
return
}
toChunk.Sections[i].BlockCount = 0
}
}
f = level.MakeBiomeFormat(version)
@@ -78,7 +84,7 @@ func (c Chunk) ToStorage(version string) (toChunk *level.Chunk, err error) {
if len(pallete) == 1 {
fillerId = pallete[0]
}
toChunk.Sections[i].Biomes, err = f.FullWith(fillerId) //TODO PALLETE index 0 if avial
toChunk.Sections[i].Biomes, err = f.FullWith(fillerId)
if err != nil {
return
}