inputItemId; } public function getIngredient() : RecipeIngredient{ return $this->ingredient; } public function getOutputItemId() : string{ return $this->outputItemId; } public function getResultFor(Item $input) : ?Item{ //TODO: this is a really awful hack, but there isn't another way for now //this relies on transforming the serialized item's ID, relying on the target item type's data being the same as the input. //This is the same assumption previously made using ItemFactory::get(), except it was less obvious how bad it was. //The other way is to bake the actual Potion class types into here, which isn't great for data-driving stuff. //We need a better solution for this. $data = GlobalItemDataHandlers::getSerializer()->serializeType($input); return $data->getName() === $this->getInputItemId() ? GlobalItemDataHandlers::getDeserializer()->deserializeType(new SavedItemData($this->getOutputItemId(), $data->getMeta(), $data->getBlock(), $data->getTag())) : null; } }