Reorder chunk unloading to leave chunks in memory for the GC time before removal

This commit is contained in:
Shoghi Cervantes 2014-07-10 01:32:18 +02:00
parent 6cb55da9c7
commit 589fde27c0

View File

@ -1670,14 +1670,6 @@ class Level implements ChunkManager, Metadatable{
public function doChunkGarbageCollection(){
$X = null;
$Z = null;
foreach($this->usedChunks as $i => $c){
if(count($c) === 0){
Level::getXZ($i, $X, $Z);
if(!$this->isSpawnChunk($X, $Z)){
$this->unloadChunkRequest($X, $Z, true);
}
}
}
if(count($this->unloadQueue) > 0){
foreach($this->unloadQueue as $index => $time){
@ -1692,6 +1684,15 @@ class Level implements ChunkManager, Metadatable{
}
}
}
foreach($this->usedChunks as $i => $c){
if(count($c) === 0){
Level::getXZ($i, $X, $Z);
if(!$this->isSpawnChunk($X, $Z)){
$this->unloadChunkRequest($X, $Z, true);
}
}
}
}