From c800c5d471259a226b0323380b6d14342ef00910 Mon Sep 17 00:00:00 2001 From: adman Date: Sat, 9 May 2026 16:34:31 +0200 Subject: [PATCH] improve chunk section palette handling for blocks --- level/anvil/chunk.go | 12 +++++++++--- tools/serve_world/main.go | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/level/anvil/chunk.go b/level/anvil/chunk.go index 57c4bf1..be4b680 100644 --- a/level/anvil/chunk.go +++ b/level/anvil/chunk.go @@ -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 } diff --git a/tools/serve_world/main.go b/tools/serve_world/main.go index 9714e4c..ef9b648 100644 --- a/tools/serve_world/main.go +++ b/tools/serve_world/main.go @@ -113,9 +113,9 @@ func Limbo(c *proto.Conn) (err error) { } err = s.Send(&v1_21_8.PlayToClientPacketPosition{ TeleportId: 0, - X: 0, + X: 0.5, Y: 100, - Z: 0, + Z: 0.5, Dx: 0, Dy: 0, Dz: 0,