From 8dd2ea22b84c1cae5354b2f015238fa7c4321af7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 4 Dec 2018 22:05:00 +0000 Subject: [PATCH] Level: make use of fromFullState() in getBlockAt() --- src/pocketmine/level/Level.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 94d41d590..31b0aa2ff 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1345,8 +1345,7 @@ class Level implements ChunkManager, Metadatable{ * @return Block */ public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{ - $id = 0; - $meta = 0; + $fullState = 0; $blockHash = null; $chunkHash = Level::chunkHash($x >> 4, $z >> 4); @@ -1360,14 +1359,12 @@ class Level implements ChunkManager, Metadatable{ $chunk = $this->chunks[$chunkHash] ?? null; if($chunk !== null){ $fullState = $chunk->getFullBlock($x & 0x0f, $y, $z & 0x0f); - $id = $fullState >> 4; - $meta = $fullState & 0xf; }else{ $addToCache = false; } } - $block = BlockFactory::get($id, $meta); + $block = BlockFactory::fromFullBlock($fullState); $block->position($this, $x, $y, $z); static $dynamicStateRead = false;