Merge branch 'release/3.3' into release/3.4

This commit is contained in:
Dylan K. Taylor 2018-11-07 22:11:13 +00:00
commit a5f776af2f
2 changed files with 4 additions and 8 deletions

View File

@ -3072,6 +3072,7 @@ class Level implements ChunkManager, Metadatable{
$this->unloadChunkRequest($X, $Z, true);
}
}
$chunk->collectGarbage();
}
$this->provider->doGarbageCollection();

View File

@ -836,18 +836,13 @@ class Chunk{
}
/**
* Disposes of empty subchunks
* Disposes of empty subchunks and frees data where possible
*/
public function pruneEmptySubChunks(){
public function collectGarbage() : void{
foreach($this->subChunks as $y => $subChunk){
if($subChunk instanceof EmptySubChunk){
continue;
}elseif($subChunk->isEmpty()){ //normal subchunk full of air, remove it and replace it with an empty stub
if(!($subChunk instanceof EmptySubChunk) and $subChunk->isEmpty()){ //normal subchunk full of air, remove it and replace it with an empty stub
$this->subChunks[$y] = $this->emptySubChunk;
}else{
continue; //do not set changed
}
$this->hasChanged = true;
}
}