Minestom / Hephaistos

NBT & Anvil save format library
MIT License
57 stars 10 forks source link

Bug: ChunkReader.getYRange() includes empty chunk sections #35

Closed NotThatRqd closed 1 year ago

NotThatRqd commented 1 year ago

You can see Eoghanmc22 and I as we were figuring this out here in the Minestom discord server

When placing a block that emits light at the height limit* (y=319) a server like Paper will save a chunk section with the lighting information. getYRange() should not include chunk sections that can not have blocks and do not have any block data, or there should be a separate function for Y range only including chunk sections with block data.

image

The chunk with a Y of 20 should be ignored because it is past the build height and has no block data

*This also probably happens when placing a block that emits light at the height min, but I haven't tested it

jglrxavpok commented 1 year ago

I have merged your fix, thanks!