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