Try to clean chunks on other threads

This commit is contained in:
Shoghi Cervantes 2015-04-15 22:14:51 +02:00
parent f79476f530
commit 7ee21f6254
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
2 changed files with 6 additions and 1 deletions

View File

@ -117,6 +117,10 @@ class SimpleChunkManager implements ChunkManager{
$this->chunks[Level::chunkHash($chunkX, $chunkZ)] = $chunk;
}
public function cleanChunks(){
$this->chunks = [];
}
/**
* Gets the level seed
*

View File

@ -127,13 +127,14 @@ class PopulationTask extends AsyncTask{
if(!$c->hasChanged()){
$chunks[$i] = null;
}
$manager->setChunk($c->getX(), $c->getZ(), null);
}else{
//This way non-changed chunks are not set
$chunks[$i] = null;
}
}
$manager->cleanChunks();
$this->chunk00 = $chunks[0] !== null ? $chunks[0]->toFastBinary() : null;
$this->chunk01 = $chunks[1] !== null ? $chunks[1]->toFastBinary() : null;
$this->chunk02 = $chunks[2] !== null ? $chunks[2]->toFastBinary() : null;