diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 2e2274386..0818f6483 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1141,17 +1141,12 @@ class Server{ * Useful for tracking entities across multiple worlds without needing strong references. * * @param int $entityId - * @param Level|null $expectedLevel Level to look in first for the target + * @param Level|null $expectedLevel @deprecated Level to look in first for the target * * @return Entity|null */ public function findEntity(int $entityId, Level $expectedLevel = null){ - $levels = $this->levels; - if($expectedLevel !== null){ - array_unshift($levels, $expectedLevel); - } - - foreach($levels as $level){ + foreach($this->levels as $level){ assert(!$level->isClosed()); if(($entity = $level->getEntity($entityId)) instanceof Entity){ return $entity; diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 977d71c8f..eb8aa1171 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -731,7 +731,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ public function getOwningEntity() : ?Entity{ $eid = $this->getOwningEntityId(); if($eid !== null){ - return $this->server->findEntity($eid, $this->level); + return $this->server->findEntity($eid); } return null; @@ -771,7 +771,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ public function getTargetEntity() : ?Entity{ $eid = $this->getTargetEntityId(); if($eid !== null){ - return $this->server->findEntity($eid, $this->level); + return $this->server->findEntity($eid); } return null; diff --git a/src/pocketmine/entity/object/ExperienceOrb.php b/src/pocketmine/entity/object/ExperienceOrb.php index 44d30ee76..01c0eaf6b 100644 --- a/src/pocketmine/entity/object/ExperienceOrb.php +++ b/src/pocketmine/entity/object/ExperienceOrb.php @@ -147,7 +147,7 @@ class ExperienceOrb extends Entity{ return null; } - $entity = $this->server->findEntity($this->targetPlayerRuntimeId, $this->level); + $entity = $this->server->findEntity($this->targetPlayerRuntimeId); if($entity instanceof Human){ return $entity; } diff --git a/src/pocketmine/event/entity/EntityDamageByChildEntityEvent.php b/src/pocketmine/event/entity/EntityDamageByChildEntityEvent.php index 0d691be51..879af9e68 100644 --- a/src/pocketmine/event/entity/EntityDamageByChildEntityEvent.php +++ b/src/pocketmine/event/entity/EntityDamageByChildEntityEvent.php @@ -51,6 +51,6 @@ class EntityDamageByChildEntityEvent extends EntityDamageByEntityEvent{ * @return Entity|null */ public function getChild() : ?Entity{ - return $this->getEntity()->getLevel()->getServer()->findEntity($this->childEntityEid, $this->getEntity()->getLevel()); + return $this->getEntity()->getLevel()->getServer()->findEntity($this->childEntityEid); } } diff --git a/src/pocketmine/event/entity/EntityDamageByEntityEvent.php b/src/pocketmine/event/entity/EntityDamageByEntityEvent.php index 4f935f722..970818aa5 100644 --- a/src/pocketmine/event/entity/EntityDamageByEntityEvent.php +++ b/src/pocketmine/event/entity/EntityDamageByEntityEvent.php @@ -69,7 +69,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{ * @return Entity|null */ public function getDamager() : ?Entity{ - return $this->getEntity()->getLevel()->getServer()->findEntity($this->damagerEntityId, $this->getEntity()->getLevel()); + return $this->getEntity()->getLevel()->getServer()->findEntity($this->damagerEntityId); } /**