mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-19 09:30:32 +00:00
Level: make use of fromFullState() in getBlockAt()
This commit is contained in:
parent
47e62b1b38
commit
8dd2ea22b8
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user