From 5701e733cc256999c64e6c49eb74d48d69bd9b53 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 31 Oct 2020 22:36:12 +0000 Subject: [PATCH] World: fixed a crash in getFullBlock() when used on ungenerated terrain --- src/world/World.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/world/World.php b/src/world/World.php index 999ad614d..03a99cce7 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1295,7 +1295,10 @@ class World implements ChunkManager{ * @return int bitmap, (id << 4) | data */ public function getFullBlock(int $x, int $y, int $z) : int{ - return $this->getOrLoadChunk($x >> 4, $z >> 4, false)->getFullBlock($x & 0x0f, $y, $z & 0x0f); + if(($chunk = $this->getOrLoadChunk($x >> 4, $z >> 4, false)) !== null){ + return $chunk->getFullBlock($x & 0x0f, $y, $z & 0x0f); + } + return BlockLegacyIds::AIR << 4; //TODO: this should throw (ungenerated chunk) } public function isInWorld(int $x, int $y, int $z) : bool{