GlassBottle: implement filling using API changes from 4afd3dcabfa6b9c645ab8b15fade1e37f889482f

closes #4827
This commit is contained in:
Dylan K. Taylor 2022-07-16 20:00:43 +01:00
parent d0ff6d2e36
commit 81edb1bed4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -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();
}
}