use of com.blamejared.crafttweaker.api.item.IIngredient in project Mekanism by mekanism.
the class CrTItemStackIngredient method from.
/**
* Creates a {@link ItemStackIngredient} that matches a given ingredient and amount.
*
* @param ingredient Ingredient to match
* @param amount Amount needed
*
* @return A {@link ItemStackIngredient} that matches a given ingredient and amount.
*/
@ZenCodeType.StaticExpansionMethod
public static ItemStackIngredient from(IIngredient ingredient, int amount) {
CrTIngredientHelper.assertValidAmount("ItemStackIngredients", amount);
// Note: the IIngredient cases also handle item tags/item stacks
Ingredient vanillaIngredient = ingredient.asVanillaIngredient();
if (vanillaIngredient == Ingredient.EMPTY) {
throw new IllegalArgumentException("ItemStackIngredients cannot be made using the empty ingredient: " + amount);
}
return ItemStackIngredient.from(vanillaIngredient, amount);
}
Aggregations