Fixed Level->getSafeSpawn() looking for blocks in chunk 0,0

This commit is contained in:
Dylan K. Taylor 2017-11-17 20:45:29 +00:00
parent bee3c4f5cd
commit 12bbc764ec

View File

@ -2703,11 +2703,11 @@ class Level implements ChunkManager, Metadatable{
$max = $this->provider->getWorldHeight();
$v = $spawn->floor();
$chunk = $this->getChunk($v->x >> 4, $v->z >> 4, false);
$x = $v->x & 0x0f;
$z = $v->z & 0x0f;
$x = (int) $v->x;
$z = (int) $v->z;
if($chunk !== null){
$y = (int) min($max - 2, $v->y);
$wasAir = ($chunk->getBlockId($x, $y - 1, $z) === 0);
$wasAir = ($chunk->getBlockId($x & 0x0f, $y - 1, $z & 0x0f) === 0);
for(; $y > 0; --$y){
if($this->isFullBlock($this->getBlockAt($x, $y, $z))){
if($wasAir){