From eaab1a87847422c0fc83843de4db2bc6d2a773cb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 7 Feb 2024 18:58:41 +0000 Subject: [PATCH] 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. --- src/network/mcpe/serializer/ChunkSerializer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/mcpe/serializer/ChunkSerializer.php b/src/network/mcpe/serializer/ChunkSerializer.php index bd2b0736c..e089daef5 100644 --- a/src/network/mcpe/serializer/ChunkSerializer.php +++ b/src/network/mcpe/serializer/ChunkSerializer.php @@ -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; }