diff --git a/src/item/GlassBottle.php b/src/item/GlassBottle.php index ca59fd2b3..bda6d132e 100644 --- a/src/item/GlassBottle.php +++ b/src/item/GlassBottle.php @@ -23,6 +23,21 @@ declare(strict_types=1); namespace pocketmine\item; +use pocketmine\block\Block; +use pocketmine\block\BlockTypeIds; +use pocketmine\math\Vector3; +use pocketmine\player\Player; + class GlassBottle extends Item{ + public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, array &$returnedItems) : ItemUseResult{ + if($blockClicked->getTypeId() === BlockTypeIds::WATER){ + $this->pop(); + $returnedItems[] = VanillaItems::POTION()->setType(PotionType::WATER()); + + return ItemUseResult::SUCCESS(); + } + + return ItemUseResult::NONE(); + } }