Level: Fixed 2D block cache not getting counted correctly

Fixes #1903
Closes #1906, which, while a pretty solution, is very inefficient (see PR discussion). This is an optimization of microscopic proportions, but the point still stands.
This commit is contained in:
Dylan K. Taylor 2018-01-12 11:02:43 +00:00
parent 98b36fd73e
commit fe4b5498e6

View File

@ -932,8 +932,13 @@ class Level implements ChunkManager, Metadatable{
$this->chunkCache = [];
$this->blockCache = [];
}else{
if(count($this->blockCache) > 2048){
$this->blockCache = [];
$count = 0;
foreach($this->blockCache as $list){
$count += count($list);
if($count > 2048){
$this->blockCache = [];
break;
}
}
}
}