Chunk: Use getSubChunkChecked() in getFullBlock()

This commit is contained in:
Dylan K. Taylor 2020-10-31 23:06:12 +00:00
parent bacfcf258e
commit f50be1ba63
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class SimpleChunkManager implements ChunkManager{
}
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 VanillaBlocks::AIR();

View File

@ -145,7 +145,7 @@ class Chunk{
* @return int bitmap, (id << 4) | meta
*/
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);
}
/**