From 6f38031121cfcf4f1a52fd9eee7a49395624a230 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 30 Apr 2020 09:35:42 +0100 Subject: [PATCH] Liquid: do not schedule delayed blockupdate when hardening occurs on nearby blockupdate fix #3390 fix #3392 --- src/block/Lava.php | 5 ++++- src/block/Liquid.php | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/block/Lava.php b/src/block/Lava.php index e897a606b..aa1dec075 100644 --- a/src/block/Lava.php +++ b/src/block/Lava.php @@ -54,7 +54,7 @@ class Lava extends Liquid{ return 2; //TODO: this is 1 in the nether } - protected function checkForHarden() : void{ + protected function checkForHarden() : bool{ $colliding = null; foreach(Facing::ALL as $side){ if($side === Facing::DOWN){ @@ -70,10 +70,13 @@ class Lava extends Liquid{ if($colliding !== null){ if($this->decay === 0){ $this->liquidCollide($colliding, VanillaBlocks::OBSIDIAN()); + return true; }elseif($this->decay <= 4){ $this->liquidCollide($colliding, VanillaBlocks::COBBLESTONE()); + return true; } } + return false; } protected function flowIntoBlock(Block $block, int $newFlowDecay, bool $falling) : void{ diff --git a/src/block/Liquid.php b/src/block/Liquid.php index 68990cb14..3cf491640 100644 --- a/src/block/Liquid.php +++ b/src/block/Liquid.php @@ -251,8 +251,9 @@ abstract class Liquid extends Transparent{ } public function onNearbyBlockChange() : void{ - $this->checkForHarden(); - $this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, $this->tickRate()); + if(!$this->checkForHarden()){ + $this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, $this->tickRate()); + } } public function onScheduledUpdate() : void{ @@ -469,8 +470,8 @@ abstract class Liquid extends Transparent{ return ($decay >= 0 && $blockDecay >= $decay) ? $decay : $blockDecay; } - protected function checkForHarden() : void{ - + protected function checkForHarden() : bool{ + return false; } protected function liquidCollide(Block $cause, Block $result) : bool{