From 06b80a9536cc4cffd39d3cc22a5701337fea4a1a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 11 Jul 2018 10:17:59 +0100 Subject: [PATCH] Level: Make getSafeSpawn() account for non-generated chunks fixes #2295 There is still an issue in that the spawn point will not be offset if the chunk is not generated, but this is better than the spawn point being down at y=0. The other issue is a job for another time. --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index b8a6fc9e2..cf29c43f0 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2791,7 +2791,7 @@ class Level implements ChunkManager, Metadatable{ $chunk = $this->getChunk($v->x >> 4, $v->z >> 4, false); $x = (int) $v->x; $z = (int) $v->z; - if($chunk !== null){ + if($chunk !== null and $chunk->isGenerated()){ $y = (int) min($max - 2, $v->y); $wasAir = ($chunk->getBlockId($x & 0x0f, $y - 1, $z & 0x0f) === 0); for(; $y > 0; --$y){