diff --git a/src/pocketmine/block/Lava.php b/src/pocketmine/block/Lava.php index da318c31d..6cd1273d1 100644 --- a/src/pocketmine/block/Lava.php +++ b/src/pocketmine/block/Lava.php @@ -48,6 +48,14 @@ class Lava extends Liquid{ return "Lava"; } + public function getStillForm() : Block{ + return BlockFactory::get(Block::STILL_LAVA, $this->meta); + } + + public function getFlowingForm() : Block{ + return BlockFactory::get(Block::FLOWING_LAVA, $this->meta); + } + public function tickRate() : int{ return 30; } diff --git a/src/pocketmine/block/Liquid.php b/src/pocketmine/block/Liquid.php index d0b4c703d..996a614b0 100644 --- a/src/pocketmine/block/Liquid.php +++ b/src/pocketmine/block/Liquid.php @@ -76,6 +76,10 @@ abstract class Liquid extends Transparent{ return []; } + abstract public function getStillForm() : Block; + + abstract public function getFlowingForm() : Block; + public function getFluidHeightPercent(){ $d = $this->meta; if($d >= 8){ diff --git a/src/pocketmine/block/Water.php b/src/pocketmine/block/Water.php index f91d887b7..3fcad9751 100644 --- a/src/pocketmine/block/Water.php +++ b/src/pocketmine/block/Water.php @@ -44,6 +44,14 @@ class Water extends Liquid{ return 2; } + public function getStillForm() : Block{ + return BlockFactory::get(Block::STILL_WATER, $this->meta); + } + + public function getFlowingForm() : Block{ + return BlockFactory::get(Block::FLOWING_WATER, $this->meta); + } + public function tickRate() : int{ return 5; } diff --git a/src/pocketmine/item/Bucket.php b/src/pocketmine/item/Bucket.php index 701371c9d..9a0a5921c 100644 --- a/src/pocketmine/item/Bucket.php +++ b/src/pocketmine/item/Bucket.php @@ -59,7 +59,7 @@ class Bucket extends Item implements Consumable{ $stack = clone $this; $resultItem = $stack->pop(); - $resultItem->setDamage($blockClicked->getId()); + $resultItem->setDamage($blockClicked->getFlowingForm()->getId()); $player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $blockReplace, $face, $this, $resultItem)); if(!$ev->isCancelled()){ $player->getLevel()->setBlock($blockClicked, BlockFactory::get(Block::AIR), true, true); @@ -84,7 +84,7 @@ class Bucket extends Item implements Consumable{ $resultItem->setDamage(0); $player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketEmptyEvent($player, $blockReplace, $face, $this, $resultItem)); if(!$ev->isCancelled()){ - $player->getLevel()->setBlock($blockReplace, $resultBlock, true, true); + $player->getLevel()->setBlock($blockReplace, $resultBlock->getFlowingForm(), true, true); if($player->isSurvival()){ $player->getInventory()->setItemInHand($ev->getItem()); }