Fixed Leaf Decay loops causing Lag Spikes, fixed #391 [gh#391]

This commit is contained in:
Shoghi Cervantes
2013-06-16 17:18:15 +02:00
parent 19d0c70669
commit 155c918bb8
2 changed files with 49 additions and 8 deletions

View File

@ -785,16 +785,16 @@ class BlockAPI{
$offset = 0;
while(true){
$t = $offset + Utils::getRandomUpdateTicks() * 0.05;
$update = $this->server->query("SELECT COUNT(*) FROM blockUpdates WHERE level = '".$pos->level->getName()."' AND type = ".BLOCK_UPDATE_RANDOM." AND delay >= ".($time + $t - 1.5)." AND delay <= ".($time + $t + 1.5).";");
$update = $this->server->query("SELECT COUNT(*) FROM blockUpdates WHERE level = '".$pos->level->getName()."' AND type = ".BLOCK_UPDATE_RANDOM." AND delay >= ".($time + $t - 1)." AND delay <= ".($time + $t + 1).";");
if($update instanceof SQLite3Result){
$update = $update->fetchArray(SQLITE3_NUM);
if($update[0] == 0){
if($update[0] < 3){
break;
}
}else{
break;
}
$offset += 10;
$offset += 5;
}
$this->scheduleBlockUpdate($pos, $t / 0.05, BLOCK_UPDATE_RANDOM);
}