removeEntity() public method

Removes the entity from the level index
public removeEntity ( Entity $entity )
$entity pocketmine\entity\Entity
 public function onUnload(ChunkUnloadEvent $event)
 {
     if ($event->getLevel() === $this->level) {
         foreach ($this->locs[Level::chunkHash($event->getChunk()->getX(), $event->getChunk()->getZ())] as $id => $spawn) {
             if (isset($this->spawns[$spawn->getId()])) {
                 $this->level->removeEntity($this->spawns[$spawn->getId()]);
             }
         }
     }
 }