ChunkSerializer: fixed count calculation for non-overworld chunks

plugins that implement dimensions can't change the number of subchunks used by Chunk, they can only choose to use a subset of them.
This commit is contained in:
Dylan K. Taylor 2024-02-07 18:58:41 +00:00
parent 169d3e0de8
commit eaab1a8784
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -71,7 +71,7 @@ final class ChunkSerializer{
//if the protocol world bounds ever exceed the PM supported bounds again in the future, we might need to
//polyfill some stuff here
[$minSubChunkIndex, $maxSubChunkIndex] = self::getDimensionChunkBounds($dimensionId);
for($y = $maxSubChunkIndex, $count = count($chunk->getSubChunks()); $y >= $minSubChunkIndex; --$y, --$count){
for($y = $maxSubChunkIndex, $count = $maxSubChunkIndex - $minSubChunkIndex + 1; $y >= $minSubChunkIndex; --$y, --$count){
if($chunk->getSubChunk($y)->isEmptyFast()){
continue;
}