Added a hack for multiworld. This is not always reliable! (#263)

This commit is contained in:
Dylan K. Taylor 2017-01-17 10:28:48 +00:00 committed by GitHub
parent cb187be1a1
commit 162b993e65

View File

@ -662,12 +662,21 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$level = $level === null ? $this->level : $level; $level = $level === null ? $this->level : $level;
$index = Level::chunkHash($x, $z); $index = Level::chunkHash($x, $z);
if(isset($this->usedChunks[$index])){ if(isset($this->usedChunks[$index])){
foreach($level->getChunkEntities($x, $z) as $entity){ $chunk = $level->getChunk($x, $z);
foreach($chunk->getEntities() as $entity){
if($entity !== $this){ if($entity !== $this){
$entity->despawnFrom($this); $entity->despawnFrom($this);
} }
} }
if($level !== $this->level){
$pk = new FullChunkDataPacket();
$pk->chunkX = $x;
$pk->chunkZ = $z;
$pk->data = chr($chunk->getSubChunkSendCount());
$this->dataPacket($pk);
}
unset($this->usedChunks[$index]); unset($this->usedChunks[$index]);
} }
$level->unregisterChunkLoader($this, $x, $z); $level->unregisterChunkLoader($this, $x, $z);