mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-11 14:02:05 +00:00
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:
parent
7472c5b73d
commit
f01d87474d
@ -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));
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user