From 793081d8034e906812f187765f1539bb2c113ea3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 27 Dec 2020 19:20:37 +0000 Subject: [PATCH] Entity: assume that position has a valid World during setPosition() --- src/entity/Entity.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index a84c74245..b50844d65 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1306,8 +1306,7 @@ abstract class Entity{ } $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->isValid() ? $pos->getWorld() : $oldWorld; + $newWorld = $pos instanceof Position ? $pos->getWorld() : $oldWorld; if($oldWorld !== $newWorld){ $this->despawnFromAll(); $oldWorld->removeEntity($this);