Search in sources :

Example 1 with IIngredient

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);
}
Also used : Ingredient(net.minecraft.item.crafting.Ingredient) ItemStackIngredient(mekanism.api.recipes.inputs.ItemStackIngredient) IIngredient(com.blamejared.crafttweaker.api.item.IIngredient)

Aggregations

IIngredient (com.blamejared.crafttweaker.api.item.IIngredient)1 ItemStackIngredient (mekanism.api.recipes.inputs.ItemStackIngredient)1 Ingredient (net.minecraft.item.crafting.Ingredient)1