From 15459031597207dbcf9d47e18b9f296fc1cfd74c Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 7 Sep 2023 11:59:15 +0300 Subject: [PATCH] infinite obsidian generator should be fixed --- src/material/block/liquid/LavaBlock.php | 6 +++--- src/material/block/liquid/WaterBlock.php | 4 ++-- src/material/item/generic/BucketItem.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/material/block/liquid/LavaBlock.php b/src/material/block/liquid/LavaBlock.php index 300e74a1..832f688b 100644 --- a/src/material/block/liquid/LavaBlock.php +++ b/src/material/block/liquid/LavaBlock.php @@ -34,7 +34,7 @@ class LavaBlock extends LiquidBlock implements LightingBlock{ for($side = 0; $side <= 5; ++$side){ $b = $this->getSide($side); if($b instanceof WaterBlock){ - $level = $this->meta & 0x06; + $level = $this->meta & 0x07; if($level == 0x00){ $this->level->setBlock($b, new ObsidianBlock(), false, false, true); }else{ @@ -66,9 +66,9 @@ class LavaBlock extends LiquidBlock implements LightingBlock{ return false; } - if($this->checkWater()){ + /*if($this->checkWater()){ return; - } + }*/ $falling = $this->meta >> 3; $down = $this->getSide(0); diff --git a/src/material/block/liquid/WaterBlock.php b/src/material/block/liquid/WaterBlock.php index aaf8083c..4f6197a2 100644 --- a/src/material/block/liquid/WaterBlock.php +++ b/src/material/block/liquid/WaterBlock.php @@ -33,7 +33,7 @@ class WaterBlock extends LiquidBlock{ } $b = $this->getSide($side); if($b instanceof LavaBlock){ - $level = $b->meta & 0x07; + $level = $b->meta & 0x06; if($level == 0x00){ $this->level->setBlock($b, new ObsidianBlock(), false, false, true); }else{ @@ -118,4 +118,4 @@ class WaterBlock extends LiquidBlock{ } return false; } -} \ No newline at end of file +} diff --git a/src/material/item/generic/BucketItem.php b/src/material/item/generic/BucketItem.php index 4d23cccb..493a8ef3 100644 --- a/src/material/item/generic/BucketItem.php +++ b/src/material/item/generic/BucketItem.php @@ -36,7 +36,7 @@ class BucketItem extends Item{ return true; } }elseif($this->meta === LAVA){ - if($block->getID() === AIR){ + if($block->getID() === AIR || ($block instanceof LavaBlock && ($block->getMetadata() & 0x6) != 0)){ $lava = new LavaBlock(); $level->setBlock($block, $lava, true, false, true); ServerAPI::request()->api->block->scheduleBlockUpdate($block, 40, BLOCK_UPDATE_NORMAL); @@ -45,8 +45,14 @@ class BucketItem extends Item{ $this->meta = 0; } return true; + }elseif($block instanceof WaterBlock){ + $level->setBlock($block, new ObsidianBlock(), true, false, true); + if(($player->gamemode & 0x01) === 0){ + $this->meta = 0; + } + return true; } } return false; } -} \ No newline at end of file +}