mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Chunk: Use getSubChunkChecked() in getFullBlock()
This commit is contained in:
parent
bacfcf258e
commit
f50be1ba63
@ -45,7 +45,7 @@ class SimpleChunkManager implements ChunkManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockAt(int $x, int $y, int $z) : Block{
|
public function getBlockAt(int $x, int $y, int $z) : Block{
|
||||||
if(($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null){
|
if($this->isInWorld($x, $y, $z) && ($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null){
|
||||||
return BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($x & 0xf, $y, $z & 0xf));
|
return BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($x & 0xf, $y, $z & 0xf));
|
||||||
}
|
}
|
||||||
return VanillaBlocks::AIR();
|
return VanillaBlocks::AIR();
|
||||||
|
@ -145,7 +145,7 @@ class Chunk{
|
|||||||
* @return int bitmap, (id << 4) | meta
|
* @return int bitmap, (id << 4) | meta
|
||||||
*/
|
*/
|
||||||
public function getFullBlock(int $x, int $y, int $z) : int{
|
public function getFullBlock(int $x, int $y, int $z) : int{
|
||||||
return $this->getSubChunk($y >> 4)->getFullBlock($x, $y & 0x0f, $z);
|
return $this->getSubChunkChecked($y >> 4)->getFullBlock($x, $y & 0x0f, $z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user