Level: Fix minor code duplication in setChunk()

This commit is contained in:
Dylan K. Taylor 2017-12-15 16:47:59 +00:00
parent 8aff793a4f
commit 4ec8416f9a

View File

@ -2400,9 +2400,6 @@ class Level implements ChunkManager, Metadatable{
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
if($unload and $oldChunk !== null){
$this->unloadChunk($chunkX, $chunkZ, false, false);
$this->provider->setChunk($chunkX, $chunkZ, $chunk);
$this->chunks[$index] = $chunk;
}else{
$oldEntities = $oldChunk !== null ? $oldChunk->getEntities() : [];
$oldTiles = $oldChunk !== null ? $oldChunk->getTiles() : [];
@ -2418,11 +2415,11 @@ class Level implements ChunkManager, Metadatable{
$oldChunk->removeTile($tile);
$tile->chunk = $chunk;
}
$this->provider->setChunk($chunkX, $chunkZ, $chunk);
$this->chunks[$index] = $chunk;
}
$this->provider->setChunk($chunkX, $chunkZ, $chunk);
$this->chunks[$index] = $chunk;
unset($this->chunkCache[$index]);
$chunk->setChanged();