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