player doesnt fall when he is on the world border, player is not spawning on world border if he logged in nearby it

This commit is contained in:
GameHerobrine 2022-08-05 12:47:19 +03:00
parent 431063ad83
commit 4ffa7f46a4
2 changed files with 4 additions and 2 deletions

View file

@ -1425,8 +1425,7 @@ class Player{
$pk = new SetTimePacket;
$pk->time = $this->level->getTime();
$this->dataPacket($pk);
$pos = new Position($this->data->get("position")["x"], $this->data->get("position")["y"], $this->data->get("position")["z"], $this->level);
$pos = new Position(floor($this->data->get("position")["x"]), floor($this->data->get("position")["y"]), floor($this->data->get("position")["z"]), $this->level);
$pos = $this->level->getSafeSpawn($pos);
$this->teleport($pos);
$this->server->schedule(10, [$this, "teleport"], $pos);

View file

@ -419,6 +419,9 @@ class Level{
$x = (int) round($spawn->x);
$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);
}
for(; $y > 0; --$y){
$v = new Vector3($x, $y, $z);
$b = $this->getBlock($v->getSide(0));