CraftTweaker introduces IIngredient as ingredient interface.
Interfaces extending this super interface include:
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.
iron_ingot | gold_ingot).
How to get the items/fluids 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?
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.