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
This commit is contained in:
Dylan T. 2025-06-27 16:25:17 +00:00
parent 7472c5b73d
commit f01d87474d
4 changed files with 4 additions and 8 deletions

View File

@ -112,7 +112,6 @@ final class ChunkSerializer{
} }
public static function serializeSubChunk(SubChunk $subChunk, BlockTranslator $blockTranslator, PacketSerializer $stream, bool $persistentBlockStates) : void{ public static function serializeSubChunk(SubChunk $subChunk, BlockTranslator $blockTranslator, PacketSerializer $stream, bool $persistentBlockStates) : void{
// Create array from non-empty layers
$layers = []; $layers = [];
if(!$subChunk->isBlockLayerEmpty()){ if(!$subChunk->isBlockLayerEmpty()){
$layers[] = $subChunk->getBlockLayer(); $layers[] = $subChunk->getBlockLayer();
@ -120,7 +119,7 @@ final class ChunkSerializer{
if(!$subChunk->isLiquidLayerEmpty()){ if(!$subChunk->isLiquidLayerEmpty()){
$layers[] = $subChunk->getLiquidLayer(); $layers[] = $subChunk->getLiquidLayer();
} }
$stream->putByte(8); //version $stream->putByte(8); //version
$stream->putByte(count($layers)); $stream->putByte(count($layers));

View File

@ -23,9 +23,6 @@ declare(strict_types=1);
namespace pocketmine\world\format; namespace pocketmine\world\format;
use function array_map;
use function count;
class SubChunk{ class SubChunk{
public const COORD_BIT_SIZE = 4; public const COORD_BIT_SIZE = 4;
public const COORD_MASK = ~(~0 << self::COORD_BIT_SIZE); public const COORD_MASK = ~(~0 << self::COORD_BIT_SIZE);

View File

@ -74,7 +74,7 @@ final class FastChunkSerializer{
foreach($subChunks as $y => $subChunk){ foreach($subChunks as $y => $subChunk){
$stream->putByte($y); $stream->putByte($y);
$stream->putInt($subChunk->getEmptyBlockId()); $stream->putInt($subChunk->getEmptyBlockId());
// Write block and liquid layers (always present) // Write block and liquid layers (always present)
self::serializePalettedArray($stream, $subChunk->getBlockLayer()); self::serializePalettedArray($stream, $subChunk->getBlockLayer());
self::serializePalettedArray($stream, $subChunk->getLiquidLayer()); self::serializePalettedArray($stream, $subChunk->getLiquidLayer());
@ -114,7 +114,7 @@ final class FastChunkSerializer{
$blockLayer = self::deserializePalettedArray($stream); $blockLayer = self::deserializePalettedArray($stream);
$liquidLayer = self::deserializePalettedArray($stream); $liquidLayer = self::deserializePalettedArray($stream);
$biomeArray = self::deserializePalettedArray($stream); $biomeArray = self::deserializePalettedArray($stream);
$subChunks[$y] = new SubChunk($airBlockId, $blockLayer, $liquidLayer, $biomeArray); $subChunks[$y] = new SubChunk($airBlockId, $blockLayer, $liquidLayer, $biomeArray);
} }

View File

@ -74,7 +74,7 @@ class BlockLightUpdate extends LightUpdate{
} }
} }
} }
if($hasLightEmitter){ if($hasLightEmitter){
$lightSources += $this->scanForLightEmittingBlocks($subChunk, $chunkX << SubChunk::COORD_BIT_SIZE, $subChunkY << SubChunk::COORD_BIT_SIZE, $chunkZ << SubChunk::COORD_BIT_SIZE); $lightSources += $this->scanForLightEmittingBlocks($subChunk, $chunkX << SubChunk::COORD_BIT_SIZE, $subChunkY << SubChunk::COORD_BIT_SIZE, $chunkZ << SubChunk::COORD_BIT_SIZE);
} }