Unload entities from chunks, possible fix for #2157, fixes #2165

This commit is contained in:
Shoghi Cervantes 2014-10-07 09:27:18 +02:00
parent 3b7ece3363
commit 8769d2bcd1

View File

@ -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);
}