From f50be1ba63426a72c76684118c8f275049f374c7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 31 Oct 2020 23:06:12 +0000 Subject: [PATCH] Chunk: Use getSubChunkChecked() in getFullBlock() --- src/world/SimpleChunkManager.php | 2 +- src/world/format/Chunk.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/SimpleChunkManager.php b/src/world/SimpleChunkManager.php index 1eb6ef17b..cfa67f9a5 100644 --- a/src/world/SimpleChunkManager.php +++ b/src/world/SimpleChunkManager.php @@ -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(); diff --git a/src/world/format/Chunk.php b/src/world/format/Chunk.php index 6fc74fc2f..7f3f06162 100644 --- a/src/world/format/Chunk.php +++ b/src/world/format/Chunk.php @@ -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); } /**