mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Entity: assume that position has a valid World during setPosition()
This commit is contained in:
parent
f215207a27
commit
793081d803
@ -1306,8 +1306,7 @@ abstract class Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oldWorld = $this->getWorld();
|
$oldWorld = $this->getWorld();
|
||||||
//TODO: staying in the same world when the target is invalid is probably not expected behaviour... this should bail instead
|
$newWorld = $pos instanceof Position ? $pos->getWorld() : $oldWorld;
|
||||||
$newWorld = $pos instanceof Position && $pos->isValid() ? $pos->getWorld() : $oldWorld;
|
|
||||||
if($oldWorld !== $newWorld){
|
if($oldWorld !== $newWorld){
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
$oldWorld->removeEntity($this);
|
$oldWorld->removeEntity($this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user