Despawn entities correctly from clients as they move

This commit is contained in:
Shoghi Cervantes 2014-11-01 16:47:40 +01:00
parent bf596ebf05
commit f8f1e0e9df

View File

@ -531,9 +531,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
}
}
$this->level->freeChunk($x, $z, $this);
unset($this->usedChunks[$index]);
}
$this->level->freeChunk($x, $z, $this);
unset($this->loadQueue[$index]);
}
@ -724,13 +724,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$X = null;
$Z = null;
Level::getXZ($index, $X, $Z);
foreach($this->level->getChunkEntities($X, $Z) as $entity){
if($entity !== $this){
$entity->despawnFrom($this);
}
}
unset($this->usedChunks[$index]);
$this->unloadChunk($X, $Z);
}
return true;