Crafting Ingredients
Link to crafting-ingredients
CraftTweaker introduces IIngredient as ingredient interface.
Interfaces extending this super interface include:
Which to choose
Link to which-to-choose
Preferably, you always use IIngredient. Why?
Because a lot of users expect all recipes that accept an IItemStack to also accept an IOreDictEntry, that's why.
Also, some functions like IngredientConditions return an IIngredient (e.g. <mincraft:grass>.onlyDamaged()
or iron_ingot | gold_ingot
).
How to get the items/fluids from the ingredient?
Link to how-to-get-the-itemsfluids-from-the-ingredient
There are many ways to retrieve your wanted type:
You can use ingredient.getItems()
to get all matching items as List<IItemStack>
. This means however, that the item would lose its Conditions, if it had any! For fluids, you can use ingredients.getFluids()
to get all matching fluids as List<ILiquidStack>
. This means however, that the fluid would lose its Conditions, if it had any!
How to get the actual ItemStack/FluidStack?
Link to how-to-get-the-actual-itemstackfluidstack
Depends: You could use CraftTweakerMC.
Alternatively, if you depend on MTLib, you can use its input helper.
If you need to rely on ItemConditions, you can always use the ingredient.matches(IItemStack other)
method.