mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 04:00:29 +00:00
Position: rename getWorldNonNull() to getWorld(), remove original getWorld()
This commit is contained in:
@@ -223,7 +223,7 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
$this->id = self::nextRuntimeId();
|
||||
$this->server = $location->getWorldNonNull()->getServer();
|
||||
$this->server = $location->getWorld()->getServer();
|
||||
|
||||
$this->location = $location->asLocation();
|
||||
assert(
|
||||
@@ -1289,7 +1289,7 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
public function getWorld() : World{
|
||||
return $this->location->getWorldNonNull();
|
||||
return $this->location->getWorld();
|
||||
}
|
||||
|
||||
protected function setPosition(Vector3 $pos) : bool{
|
||||
@@ -1297,8 +1297,8 @@ abstract class Entity{
|
||||
return false;
|
||||
}
|
||||
|
||||
if($pos instanceof Position and $pos->isValid() and $pos->getWorldNonNull() !== $this->getWorld()){
|
||||
if(!$this->switchWorld($pos->getWorldNonNull())){
|
||||
if($pos instanceof Position and $pos->isValid() and $pos->getWorld() !== $this->getWorld()){
|
||||
if(!$this->switchWorld($pos->getWorld())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1410,7 +1410,7 @@ abstract class Entity{
|
||||
$pitch = $pitch ?? $pos->pitch;
|
||||
}
|
||||
$from = $this->location->asPosition();
|
||||
$to = Position::fromObject($pos, $pos instanceof Position ? $pos->getWorldNonNull() : $this->getWorld());
|
||||
$to = Position::fromObject($pos, $pos instanceof Position ? $pos->getWorld() : $this->getWorld());
|
||||
$ev = new EntityTeleportEvent($this, $from, $to);
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
|
@@ -63,7 +63,7 @@ class Location extends Position{
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
return "Location (world=" . ($this->isValid() ? $this->getWorldNonNull()->getDisplayName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)";
|
||||
return "Location (world=" . ($this->isValid() ? $this->getWorld()->getDisplayName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)";
|
||||
}
|
||||
|
||||
public function equals(Vector3 $v) : bool{
|
||||
|
Reference in New Issue
Block a user