Fixed excessive idle CPU usage for chunk ticking

"excessive" = 5%, after changes = 1.6% - YMMV, but that's my machine.
This commit is contained in:
Dylan K. Taylor 2017-10-20 15:54:15 +01:00
parent e318dc12a5
commit 30211bee82

View File

@ -47,6 +47,7 @@ use pocketmine\event\Timings;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\level\format\Chunk;
use pocketmine\level\format\EmptySubChunk;
use pocketmine\level\format\io\BaseLevelProvider;
use pocketmine\level\format\io\LevelProvider;
use pocketmine\level\generator\GenerationTask;
@ -956,7 +957,7 @@ class Level implements ChunkManager, Metadatable{
foreach($chunk->getSubChunks() as $Y => $subChunk){
if(!$subChunk->isEmpty()){
if(!($subChunk instanceof EmptySubChunk)){
for($i = 0; $i < 3; ++$i){
$k = mt_rand(0, 0xfff);
$x = $k & 0x0f;