mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fixed Leaf Decay loops causing Lag Spikes, fixed #391 [gh#391]
This commit is contained in:
parent
19d0c70669
commit
155c918bb8
2 changed files with 49 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue