示例#1
0
 /**
  * Removes the entity from the level index
  *
  * @param Entity $entity
  *
  * @throws LevelException
  */
 public function removeEntity(Entity $entity)
 {
     if ($entity->getLevel() !== $this) {
         throw new LevelException("Invalid Entity level");
     }
     if ($entity instanceof Player) {
         unset($this->players[$entity->getId()]);
         $this->checkSleep();
     } elseif ($entity instanceof ExperienceOrb) {
         $entity->close();
     } else {
         $entity->kill();
     }
     unset($this->entities[$entity->getId()]);
     unset($this->updateEntities[$entity->getId()]);
 }