block ticking changes(should not lag that much now), chamge back if any issues will start to appear

This commit is contained in:
GameHerobrine 2022-12-12 19:17:16 +03:00
parent 569f81c70c
commit 03059f7677
2 changed files with 8 additions and 3 deletions

View file

@ -531,7 +531,8 @@ class BlockAPI{
$this->blockUpdateAround($block, $level);
$this->server->api->entity->updateRadius($pos, 1);
}elseif($level === BLOCK_UPDATE_RANDOM){
$this->nextRandomUpdate($pos);
//$this->nextRandomUpdate($pos); old version, change back if any issues will start to happen with this one(please note that old version makes a lot of lag)
$this->scheduleBlockUpdate($pos, (mt_rand(25, 75) + Utils::getRandomUpdateTicks() * 0.05) / 0.05, BLOCK_UPDATE_RANDOM);
}
return $level;
}

View file

@ -316,7 +316,11 @@ class PMFLevel extends PMF{
$this->locationTable[$index][0] |= 1 << $Y;
return true;
}
private function report(){
console("[ERROR] A weird error in PMFLevel just happeneed. Values: ");
var_dump(func_get_args());
console("[NOTICE] If you see this message, you should send the log with error to the devs.");
}
public function getBlockID($x, $y, $z){
if($y > 127 or $y < 0 or $x < 0 or $z < 0 or $x > 255 or $z > 255){
return 0;
@ -328,7 +332,7 @@ class PMFLevel extends PMF{
$aX = $x - ($X << 4);
$aZ = $z - ($Z << 4);
$aY = $y - ($Y << 4);
$b = ord($this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))]);
$b = ord($this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))]) or $this->report($index, $Y, ($aY + ($aX << 5) + ($aZ << 9)), $x, $y, $z);
return $b;
}