mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
fixed overoptimized code in getSafeSpawn(), close #1248
This commit is contained in:
parent
28188e5ef4
commit
5178373d8a
@ -2709,9 +2709,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$y = (int) min($max - 2, $v->y);
|
||||
$wasAir = ($chunk->getBlockId($x, $y - 1, $z) === 0);
|
||||
for(; $y > 0; --$y){
|
||||
$b = $chunk->getFullBlock($x, $y, $z);
|
||||
$block = BlockFactory::get($b >> 4, $b & 0x0f);
|
||||
if($this->isFullBlock($block)){
|
||||
if($this->isFullBlock($this->getBlockAt($x, $y, $z))){
|
||||
if($wasAir){
|
||||
$y++;
|
||||
break;
|
||||
@ -2722,12 +2720,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
for(; $y >= 0 and $y < $max; ++$y){
|
||||
$b = $chunk->getFullBlock($x, $y + 1, $z);
|
||||
$block = BlockFactory::get($b >> 4, $b & 0x0f);
|
||||
if(!$this->isFullBlock($block)){
|
||||
$b = $chunk->getFullBlock($x, $y, $z);
|
||||
$block = BlockFactory::get($b >> 4, $b & 0x0f);
|
||||
if(!$this->isFullBlock($block)){
|
||||
if(!$this->isFullBlock($this->getBlockAt($x, $y + 1, $z))){
|
||||
if(!$this->isFullBlock($this->getBlockAt($x, $y, $z))){
|
||||
return new Position($spawn->x, $y === (int) $spawn->y ? $spawn->y : $y, $spawn->z, $this);
|
||||
}
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user