From f01d87474d8e1fb26887de9be55de4a85320d95e Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Fri, 27 Jun 2025 16:25:17 +0000 Subject: [PATCH] Final cleanup: fix imports and indentation - Remove unused imports (array_map, count) from SubChunk.php - Fix indentation in ChunkSerializer.php serializeSubChunk method - Fix indentation in FastChunkSerializer.php serialize/deserialize methods - Ensure consistent tab-based indentation throughout all modified files - Clean up whitespace and formatting issues --- src/network/mcpe/serializer/ChunkSerializer.php | 3 +-- src/world/format/SubChunk.php | 3 --- src/world/format/io/FastChunkSerializer.php | 4 ++-- src/world/light/BlockLightUpdate.php | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/network/mcpe/serializer/ChunkSerializer.php b/src/network/mcpe/serializer/ChunkSerializer.php index 62b50eab2..c536c691c 100644 --- a/src/network/mcpe/serializer/ChunkSerializer.php +++ b/src/network/mcpe/serializer/ChunkSerializer.php @@ -112,7 +112,6 @@ final class ChunkSerializer{ } public static function serializeSubChunk(SubChunk $subChunk, BlockTranslator $blockTranslator, PacketSerializer $stream, bool $persistentBlockStates) : void{ - // Create array from non-empty layers $layers = []; if(!$subChunk->isBlockLayerEmpty()){ $layers[] = $subChunk->getBlockLayer(); @@ -120,7 +119,7 @@ final class ChunkSerializer{ if(!$subChunk->isLiquidLayerEmpty()){ $layers[] = $subChunk->getLiquidLayer(); } - + $stream->putByte(8); //version $stream->putByte(count($layers)); diff --git a/src/world/format/SubChunk.php b/src/world/format/SubChunk.php index 497d1911c..3dd11355b 100644 --- a/src/world/format/SubChunk.php +++ b/src/world/format/SubChunk.php @@ -23,9 +23,6 @@ declare(strict_types=1); namespace pocketmine\world\format; -use function array_map; -use function count; - class SubChunk{ public const COORD_BIT_SIZE = 4; public const COORD_MASK = ~(~0 << self::COORD_BIT_SIZE); diff --git a/src/world/format/io/FastChunkSerializer.php b/src/world/format/io/FastChunkSerializer.php index 30bd5fe65..457fc886a 100644 --- a/src/world/format/io/FastChunkSerializer.php +++ b/src/world/format/io/FastChunkSerializer.php @@ -74,7 +74,7 @@ final class FastChunkSerializer{ foreach($subChunks as $y => $subChunk){ $stream->putByte($y); $stream->putInt($subChunk->getEmptyBlockId()); - + // Write block and liquid layers (always present) self::serializePalettedArray($stream, $subChunk->getBlockLayer()); self::serializePalettedArray($stream, $subChunk->getLiquidLayer()); @@ -114,7 +114,7 @@ final class FastChunkSerializer{ $blockLayer = self::deserializePalettedArray($stream); $liquidLayer = self::deserializePalettedArray($stream); $biomeArray = self::deserializePalettedArray($stream); - + $subChunks[$y] = new SubChunk($airBlockId, $blockLayer, $liquidLayer, $biomeArray); } diff --git a/src/world/light/BlockLightUpdate.php b/src/world/light/BlockLightUpdate.php index 9fb804dd0..78d1f1a9e 100644 --- a/src/world/light/BlockLightUpdate.php +++ b/src/world/light/BlockLightUpdate.php @@ -74,7 +74,7 @@ class BlockLightUpdate extends LightUpdate{ } } } - + if($hasLightEmitter){ $lightSources += $this->scanForLightEmittingBlocks($subChunk, $chunkX << SubChunk::COORD_BIT_SIZE, $subChunkY << SubChunk::COORD_BIT_SIZE, $chunkZ << SubChunk::COORD_BIT_SIZE); }