22declare(strict_types=1);
27use pocketmine\block\utils\SupportType;
44 $tile = $this->position->getWorld()->getTile($this->position);
45 assert($tile instanceof TileCauldron);
48 $tile->setCustomWaterColor(
null);
49 $tile->setPotionItem(
null);
57 foreach(Facing::HORIZONTAL as $f){
64 return $facing ===
Facing::UP ? SupportType::EDGE : SupportType::NONE;
70 private function fill(
int $amount,
FillableCauldron $result,
Item $usedItem,
Item $returnedItem, array &$returnedItems) : void{
71 $this->position->getWorld()->setBlock($this->position, $result->setFillLevel($amount));
72 $this->position->getWorld()->addSound($this->position->add(0.5, 0.5, 0.5), $result->
getFillSound());
75 $returnedItems[] = $returnedItem;
79 if($item->getTypeId() ===
ItemTypeIds::WATER_BUCKET){
80 $this->fill(FillableCauldron::MAX_FILL_LEVEL, VanillaBlocks::WATER_CAULDRON(), $item, VanillaItems::BUCKET(), $returnedItems);
81 }elseif($item->getTypeId() === ItemTypeIds::LAVA_BUCKET){
82 $this->fill(FillableCauldron::MAX_FILL_LEVEL, VanillaBlocks::LAVA_CAULDRON(), $item, VanillaItems::BUCKET(), $returnedItems);
83 }elseif($item->getTypeId() === ItemTypeIds::POWDER_SNOW_BUCKET){
85 }elseif($item instanceof Potion || $item instanceof SplashPotion){
86 if($item->getType() === PotionType::WATER){
87 $this->fill(WaterCauldron::WATER_BOTTLE_FILL_AMOUNT, VanillaBlocks::WATER_CAULDRON(), $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
89 $this->fill(PotionCauldron::POTION_FILL_AMOUNT, VanillaBlocks::POTION_CAULDRON()->setPotionItem($item), $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
97 $world = $this->position->getWorld();
98 if($world->getBlock($this->position->up())->getTypeId() === BlockTypeIds::WATER){
99 $cauldron = VanillaBlocks::WATER_CAULDRON()->setFillLevel(FillableCauldron::MAX_FILL_LEVEL);
100 $world->setBlock($this->position, $cauldron);
101 $world->addSound($this->position->add(0.5, 0.5, 0.5), $cauldron->getFillSound());
recalculateCollisionBoxes()
getSupportType(int $facing)
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])