mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
getSafeSpawn will return default y if no solid blocks were found below
This commit is contained in:
parent
2091dd1a98
commit
61ee4ab335
1 changed files with 4 additions and 1 deletions
|
|
@ -821,7 +821,7 @@ class Level{
|
|||
}
|
||||
if($spawn instanceof Vector3){
|
||||
$x = (int) round($spawn->x);
|
||||
$y = (int) round($spawn->y);
|
||||
$fy = $y = (int) round($spawn->y);
|
||||
$z = (int) round($spawn->z);
|
||||
if($x < 0 || $x > 255 || $z < 0 || $z > 255){
|
||||
return new Position($x, 128, $z, $this);
|
||||
|
|
@ -835,6 +835,9 @@ class Level{
|
|||
break;
|
||||
}
|
||||
}
|
||||
if($y == 0){
|
||||
return new Position($x, $fy, $z, $this); //force tp to default if pos is empty
|
||||
}
|
||||
for(; $y < 128; ++$y){
|
||||
$v = new Vector3($x, $y, $z);
|
||||
if($this->getBlock($v->getSide(1)) instanceof AirBlock){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue