111 $world = $this->position->getWorld();
112 if(($dyeColor = match($item->getTypeId()){
113 ItemTypeIds::LAPIS_LAZULI => DyeColor::BLUE,
114 ItemTypeIds::INK_SAC => DyeColor::BLACK,
115 ItemTypeIds::COCOA_BEANS => DyeColor::BROWN,
116 ItemTypeIds::BONE_MEAL => DyeColor::WHITE,
117 ItemTypeIds::DYE => $item instanceof Dye ? $item->getColor() : null,
119 }) !==
null && ($newColor = $dyeColor->getRgbValue())->toRGBA() !== $this->customWaterColor?->toRGBA()
121 $world->setBlock($this->position, $this->setCustomWaterColor($this->customWaterColor === null ? $newColor : Color::mix($this->customWaterColor, $newColor)));
122 $world->addSound($this->position->add(0.5, 0.5, 0.5), new CauldronAddDyeSound());
126 if($item->getType() === PotionType::WATER){
127 $this->setCustomWaterColor(
null)->addFillLevels(self::WATER_BOTTLE_FILL_AMOUNT, $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
129 $this->mix($item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
131 }elseif($item instanceof
Armor){
132 if($this->customWaterColor !==
null){
133 if(match($item->getTypeId()){
134 ItemTypeIds::LEATHER_CAP,
135 ItemTypeIds::LEATHER_TUNIC,
136 ItemTypeIds::LEATHER_PANTS,
137 ItemTypeIds::LEATHER_BOOTS => true,
139 } && $item->getCustomColor()?->toRGBA() !== $this->customWaterColor->toRGBA()){
140 $item->setCustomColor($this->customWaterColor);
141 $world->setBlock($this->position, $this->withFillLevel($this->getFillLevel() - self::DYE_ARMOR_USE_AMOUNT));
144 }elseif($item->getCustomColor() !==
null){
145 $item->clearCustomColor();
146 $world->setBlock($this->position, $this->withFillLevel($this->getFillLevel() - self::CLEAN_ARMOR_USE_AMOUNT));
147 $world->addSound($this->position->add(0.5, 0.5, 0.5),
new CauldronCleanItemSound());
149 }elseif($item instanceof Banner){
150 $patterns = $item->getPatterns();
151 if(count($patterns) > 0 && $this->customWaterColor ===
null){
152 array_pop($patterns);
153 $item->setPatterns($patterns);
155 $world->setBlock($this->position, $this->withFillLevel($this->getFillLevel() - self::CLEAN_BANNER_USE_AMOUNT));
156 $world->addSound($this->position->add(0.5, 0.5, 0.5),
new CauldronCleanItemSound());
158 }elseif(ItemTypeIds::toBlockTypeId($item->getTypeId()) === BlockTypeIds::DYED_SHULKER_BOX){
159 if($this->customWaterColor ===
null){
160 $newItem = VanillaBlocks::SHULKER_BOX()->asItem();
164 $returnedItems[] = $newItem;
166 $world->setBlock($this->position, $this->withFillLevel($this->getFillLevel() - self::CLEAN_SHULKER_BOX_USE_AMOUNT));
167 $world->addSound($this->position->add(0.5, 0.5, 0.5),
new CauldronCleanItemSound());
170 match($item->getTypeId()){
171 ItemTypeIds::WATER_BUCKET => $this->setCustomWaterColor(
null)->addFillLevels(self::MAX_FILL_LEVEL, $item, VanillaItems::BUCKET(), $returnedItems),
172 ItemTypeIds::BUCKET => $this->removeFillLevels(self::MAX_FILL_LEVEL, $item, VanillaItems::WATER_BUCKET(), $returnedItems),
173 ItemTypeIds::GLASS_BOTTLE => $this->removeFillLevels(self::WATER_BOTTLE_FILL_AMOUNT, $item, VanillaItems::POTION()->setType(PotionType::WATER), $returnedItems),
174 ItemTypeIds::LAVA_BUCKET, ItemTypeIds::POWDER_SNOW_BUCKET => $this->mix($item, VanillaItems::BUCKET(), $returnedItems),