Entity: Move responsibility of checking for despawn to Level

this ensures that flagging for despawn will always work as intended, including when onUpdate() is overridden.
This commit is contained in:
Dylan K. Taylor
2018-06-07 12:31:21 +01:00
parent b331f8e1c9
commit c83c0eb935
2 changed files with 3 additions and 5 deletions

View File

@ -745,6 +745,9 @@ class Level implements ChunkManager, Metadatable{
if($entity->isClosed() or !$entity->onUpdate($currentTick)){
unset($this->updateEntities[$id]);
}
if($entity->isFlaggedForDespawn()){
$entity->close();
}
}
Timings::$tickEntityTimer->stopTiming();
$this->timings->entityTick->stopTiming();