It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import. import crafttweaker.item.IIngredient;
Usually, you won’t need this, but in some cases recipes won’t work until you import the IIngredient package.
You can do this using the following import:
If you want to use more than one of a given item, you can set an amount to an IIngredient.
This is as easy as multiplying the IIngredient with an Integer.
Retrieveing the amount is also possible.
Sometimes you want either IIngredient X or Y, but don’t want to create a recipe for each possibility?
That’s why there’s the OR Method for IIngredients:
Sometimes an IIngredient represents more than one item, for example if you are using an OreDictEntry or if you OR-ed two Ingredients.
You can get all possible items for this IIngredient as a List<IItemStack> List using the first function.
The second function does the same as the first function but returns a IItemStack[] instead of a list.
Same goes for liquids in the third function, only they return an ILiquidStack List.
Sometimes you want an item not to be consumed upon crafting but instead receive damaged or give back a completely different item.
This is what item Transformers are there for.
Sometimes you want your ingredient to have a specific tag or to only work if (not) damaged.
These Conditions can be added to your Ingredients using the following:
If you want to check if an IItemStack matches your IIngredient you can use the match method. This will return a boolean.
If the IIngredient represents a liquid, it will check if the item is a valid container for this liquid.
You can also match two IIngredient Objects, in which case you’d need to use the in operator: