Liquid: do not schedule delayed blockupdate when hardening occurs on nearby blockupdate

fix #3390
fix #3392
This commit is contained in:
Dylan K. Taylor 2020-04-30 09:35:42 +01:00
parent b74f177958
commit 6f38031121
2 changed files with 9 additions and 5 deletions

View File

@ -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{

View File

@ -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{