mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Replace hardcoded block metadata shifts and masks with constants
we might want to make these bigger than 4 bits in the future.
This commit is contained in:
@ -26,6 +26,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\format;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockLegacyIds;
|
||||
use pocketmine\block\tile\Tile;
|
||||
use pocketmine\data\bedrock\BiomeIds;
|
||||
@ -86,7 +87,7 @@ class Chunk{
|
||||
$this->subChunks = new \SplFixedArray(Chunk::MAX_SUBCHUNKS);
|
||||
|
||||
foreach($this->subChunks as $y => $null){
|
||||
$this->subChunks[$y] = $subChunks[$y] ?? new SubChunk(BlockLegacyIds::AIR << 4, []);
|
||||
$this->subChunks[$y] = $subChunks[$y] ?? new SubChunk(BlockLegacyIds::AIR << Block::INTERNAL_METADATA_BITS, []);
|
||||
}
|
||||
|
||||
$val = ($this->subChunks->getSize() * 16);
|
||||
@ -366,7 +367,7 @@ class Chunk{
|
||||
throw new \InvalidArgumentException("Invalid subchunk Y coordinate $y");
|
||||
}
|
||||
|
||||
$this->subChunks[$y] = $subChunk ?? new SubChunk(BlockLegacyIds::AIR << 4, []);
|
||||
$this->subChunks[$y] = $subChunk ?? new SubChunk(BlockLegacyIds::AIR << Block::INTERNAL_METADATA_BITS, []);
|
||||
$this->setDirtyFlag(self::DIRTY_FLAG_TERRAIN, true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user