diff --git a/src/pocketmine/level/format/EmptySubChunk.php b/src/pocketmine/level/format/EmptySubChunk.php index 1daf86723..5ca3980e0 100644 --- a/src/pocketmine/level/format/EmptySubChunk.php +++ b/src/pocketmine/level/format/EmptySubChunk.php @@ -77,22 +77,6 @@ class EmptySubChunk implements SubChunkInterface{ return -1; } - public function getBlockIdColumn(int $x, int $z) : string{ - return "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; - } - - public function getBlockDataColumn(int $x, int $z) : string{ - return "\x00\x00\x00\x00\x00\x00\x00\x00"; - } - - public function getBlockLightColumn(int $x, int $z) : string{ - return "\x00\x00\x00\x00\x00\x00\x00\x00"; - } - - public function getBlockSkyLightColumn(int $x, int $z) : string{ - return "\xff\xff\xff\xff\xff\xff\xff\xff"; - } - public function getBlockIdArray() : string{ return str_repeat("\x00", 4096); } diff --git a/src/pocketmine/level/format/SubChunk.php b/src/pocketmine/level/format/SubChunk.php index 2971690ea..1b6ed2f20 100644 --- a/src/pocketmine/level/format/SubChunk.php +++ b/src/pocketmine/level/format/SubChunk.php @@ -30,7 +30,6 @@ use function defined; use function ord; use function str_repeat; use function strlen; -use function substr; use function substr_count; if(!defined(__NAMESPACE__ . '\ZERO_NIBBLE_ARRAY')){ @@ -145,22 +144,6 @@ class SubChunk implements SubChunkInterface{ return -1; //highest block not in this subchunk } - public function getBlockIdColumn(int $x, int $z) : string{ - return substr($this->ids, ($x << 8) | ($z << 4), 16); - } - - public function getBlockDataColumn(int $x, int $z) : string{ - return substr($this->data, ($x << 7) | ($z << 3), 8); - } - - public function getBlockLightColumn(int $x, int $z) : string{ - return substr($this->blockLight, ($x << 7) | ($z << 3), 8); - } - - public function getBlockSkyLightColumn(int $x, int $z) : string{ - return substr($this->skyLight, ($x << 7) | ($z << 3), 8); - } - public function getBlockIdArray() : string{ assert(strlen($this->ids) === 4096, "Wrong length of ID array, expecting 4096 bytes, got " . strlen($this->ids)); return $this->ids; diff --git a/src/pocketmine/level/format/SubChunkInterface.php b/src/pocketmine/level/format/SubChunkInterface.php index 71226db90..5d3c718f0 100644 --- a/src/pocketmine/level/format/SubChunkInterface.php +++ b/src/pocketmine/level/format/SubChunkInterface.php @@ -116,38 +116,6 @@ interface SubChunkInterface{ */ public function getHighestBlockAt(int $x, int $z) : int; - /** - * @param int $x - * @param int $z - * - * @return string - */ - public function getBlockIdColumn(int $x, int $z) : string; - - /** - * @param int $x - * @param int $z - * - * @return string - */ - public function getBlockDataColumn(int $x, int $z) : string; - - /** - * @param int $x - * @param int $z - * - * @return string - */ - public function getBlockLightColumn(int $x, int $z) : string; - - /** - * @param int $x - * @param int $z - * - * @return string - */ - public function getBlockSkyLightColumn(int $x, int $z) : string; - /** * @return string */ diff --git a/src/pocketmine/level/format/io/region/McRegion.php b/src/pocketmine/level/format/io/region/McRegion.php index 56f1e0326..277e6ff89 100644 --- a/src/pocketmine/level/format/io/region/McRegion.php +++ b/src/pocketmine/level/format/io/region/McRegion.php @@ -65,10 +65,10 @@ class McRegion extends RegionLevelProvider{ for($z = 0; $z < 16; ++$z){ for($y = 0; $y < 8; ++$y){ $subChunk = $subChunks[$y]; - $ids .= $subChunk->getBlockIdColumn($x, $z); - $data .= $subChunk->getBlockDataColumn($x, $z); - $skyLight .= $subChunk->getBlockSkyLightColumn($x, $z); - $blockLight .= $subChunk->getBlockLightColumn($x, $z); + $ids .= substr($subChunk->getBlockIdArray(), ($x << 8) | ($z << 4), 16); + $data .= substr($subChunk->getBlockDataArray(), ($x << 7) | ($z << 3), 8); + $skyLight .= substr($subChunk->getBlockSkyLightArray(), ($x << 7) | ($z << 3), 8); + $blockLight .= substr($subChunk->getBlockLightArray(), ($x << 7) | ($z << 3), 8); } } }