From 03059f76778eb7a5b0367dfa8e0ecbe6879b3556 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Mon, 12 Dec 2022 19:17:16 +0300 Subject: [PATCH] block ticking changes(should not lag that much now), chamge back if any issues will start to appear --- src/API/BlockAPI.php | 3 ++- src/pmf/Level.php | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 363b09bc..c4fb980e 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -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; } diff --git a/src/pmf/Level.php b/src/pmf/Level.php index fa73c3d5..3f18fefa 100644 --- a/src/pmf/Level.php +++ b/src/pmf/Level.php @@ -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; }