From 8769d2bcd1f2444c4f72cbb7adc61d9d9899e548 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 7 Oct 2014 09:27:18 +0200 Subject: [PATCH] Unload entities from chunks, possible fix for #2157, fixes #2165 --- src/pocketmine/entity/Entity.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 2e3e02d2f..fe16ee129 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -585,7 +585,7 @@ abstract class Entity extends Position implements Metadatable{ } public function onUpdate(){ - if($this->closed !== false){ + if($this->closed){ return false; } $this->timings->startTiming(); @@ -1171,6 +1171,9 @@ abstract class Entity extends Position implements Metadatable{ $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; unset($this->level->updateEntities[$this->id]); + if($this->chunk instanceof FullChunk){ + $this->chunk->removeEntity($this); + } if(($level = $this->getLevel()) instanceof Level){ $level->removeEntity($this); }