World: do not update entities which have been flagged for despawn

fixes #4718
This commit is contained in:
Dylan K. Taylor 2022-01-20 16:27:21 +00:00
parent a67aef0477
commit 061d851fbd
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -854,7 +854,7 @@ class World implements ChunkManager{
//Update entities that need update
Timings::$tickEntity->startTiming();
foreach($this->updateEntities as $id => $entity){
if($entity->isClosed() or !$entity->onUpdate($currentTick)){
if($entity->isClosed() or $entity->isFlaggedForDespawn() or !$entity->onUpdate($currentTick)){
unset($this->updateEntities[$id]);
}
if($entity->isFlaggedForDespawn()){