diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 4e66e9e94..ec9466d06 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2508,6 +2508,25 @@ class Level implements ChunkManager, Metadatable{ $this->timings->syncChunkSendTimer->stopTiming(); } + /** + * @param Entity $entity + * + * @throws LevelException + */ + public function addEntity(Entity $entity){ + if($entity->isClosed()){ + throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to Level"); + } + if($entity->getLevel() !== $this){ + throw new LevelException("Invalid Entity level"); + } + + if($entity instanceof Player){ + $this->players[$entity->getId()] = $entity; + } + $this->entities[$entity->getId()] = $entity; + } + /** * Removes the entity from the level index * @@ -2529,25 +2548,6 @@ class Level implements ChunkManager, Metadatable{ unset($this->updateEntities[$entity->getId()]); } - /** - * @param Entity $entity - * - * @throws LevelException - */ - public function addEntity(Entity $entity){ - if($entity->isClosed()){ - throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to Level"); - } - if($entity->getLevel() !== $this){ - throw new LevelException("Invalid Entity level"); - } - - if($entity instanceof Player){ - $this->players[$entity->getId()] = $entity; - } - $this->entities[$entity->getId()] = $entity; - } - /** * @param Tile $tile *