mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
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:
parent
98b36fd73e
commit
fe4b5498e6
@ -932,8 +932,13 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->chunkCache = [];
|
$this->chunkCache = [];
|
||||||
$this->blockCache = [];
|
$this->blockCache = [];
|
||||||
}else{
|
}else{
|
||||||
if(count($this->blockCache) > 2048){
|
$count = 0;
|
||||||
$this->blockCache = [];
|
foreach($this->blockCache as $list){
|
||||||
|
$count += count($list);
|
||||||
|
if($count > 2048){
|
||||||
|
$this->blockCache = [];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user