Search in sources :

Example 6 with IStackHelper

use of mezz.jei.api.recipe.IStackHelper in project HorsePower by GoryMoon.

the class ShapelessChoppingCraftingWrapper method getIngredients.

@Override
public void getIngredients(IIngredients ingredients) {
    IStackHelper stackHelper = HorsePowerPlugin.jeiHelpers.getStackHelper();
    List<List<ItemStack>> inputs = stackHelper.expandRecipeItemStackInputs(recipe.getIngredients());
    ingredients.setInputLists(ItemStack.class, inputs);
    if (!outputs.isEmpty())
        ingredients.setOutputLists(ItemStack.class, outputs);
}
Also used : List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) NonNullList(net.minecraft.util.NonNullList) IStackHelper(mezz.jei.api.recipe.IStackHelper) ItemStack(net.minecraft.item.ItemStack)

Example 7 with IStackHelper

use of mezz.jei.api.recipe.IStackHelper in project HorsePower by GoryMoon.

the class ChoppingRecipeMaker method getChoppingRecipes.

public static List<ChoppingRecipeWrapper> getChoppingRecipes(IJeiHelpers helpers, boolean hand) {
    IStackHelper stackHelper = helpers.getStackHelper();
    Collection<ChoppingBlockRecipe> grindingRecipes = hand ? HPRecipes.instance().getManualChoppingRecipes() : HPRecipes.instance().getChoppingRecipes();
    List<ChoppingRecipeWrapper> recipes = new ArrayList<>();
    for (ChoppingBlockRecipe recipe : grindingRecipes) {
        ItemStack input = recipe.getInput();
        ItemStack output = recipe.getOutput();
        List<ItemStack> inputs = stackHelper.getSubtypes(input);
        ChoppingRecipeWrapper grindstoneRecipeWrapper = new ChoppingRecipeWrapper(inputs, output, recipe.getTime(), hand);
        recipes.add(grindstoneRecipeWrapper);
    }
    return recipes;
}
Also used : ArrayList(java.util.ArrayList) ChoppingBlockRecipe(se.gory_moon.horsepower.recipes.ChoppingBlockRecipe) IStackHelper(mezz.jei.api.recipe.IStackHelper) ItemStack(net.minecraft.item.ItemStack)

Example 8 with IStackHelper

use of mezz.jei.api.recipe.IStackHelper in project HorsePower by GoryMoon.

the class GrindingRecipeMaker method getGrindstoneRecipes.

public static List<GrindstoneRecipeWrapper> getGrindstoneRecipes(IJeiHelpers helpers, boolean hand) {
    IStackHelper stackHelper = helpers.getStackHelper();
    Collection<GrindstoneRecipe> grindingRecipes = hand ? HPRecipes.instance().getHandGrindstoneRecipes() : HPRecipes.instance().getGrindstoneRecipes();
    List<GrindstoneRecipeWrapper> recipes = new ArrayList<>();
    for (GrindstoneRecipe recipe : grindingRecipes) {
        ItemStack input = recipe.getInput();
        ItemStack output = recipe.getOutput();
        ItemStack secondary = recipe.getSecondary();
        List<ItemStack> inputs = stackHelper.getSubtypes(input);
        GrindstoneRecipeWrapper grindstoneRecipeWrapper = new GrindstoneRecipeWrapper(inputs, output, secondary, recipe.getSecondaryChance(), recipe.getTime());
        recipes.add(grindstoneRecipeWrapper);
    }
    return recipes;
}
Also used : ArrayList(java.util.ArrayList) GrindstoneRecipe(se.gory_moon.horsepower.recipes.GrindstoneRecipe) IStackHelper(mezz.jei.api.recipe.IStackHelper) ItemStack(net.minecraft.item.ItemStack)

Example 9 with IStackHelper

use of mezz.jei.api.recipe.IStackHelper in project Binnie by ForestryMC.

the class DatabaseRecipeMaker method create.

public static List<DatabaseRecipeWrapper> create() {
    List<DatabaseRecipeWrapper> recipes = new ArrayList<>();
    ModuleItems items = Genetics.items();
    {
        ItemStack emptySerum = GeneticsItems.EMPTY_SERUM.get(1);
        ItemStack resultSerum = new ItemStack(items.itemSerum, 1, OreDictionary.WILDCARD_VALUE);
        IStackHelper stackHelper = GeneticsJeiPlugin.jeiHelpers.getStackHelper();
        List<ItemStack> subtypes = stackHelper.toItemStackList(resultSerum);
        List<ItemStack> resultSerums = new ArrayList<>();
        for (ItemStack subtype : subtypes) {
            subtype = subtype.copy();
            subtype.setItemDamage(subtype.getMaxDamage());
            resultSerums.add(subtype);
        }
        recipes.add(new DatabaseRecipeWrapper(emptySerum, resultSerums));
    }
    {
        ItemStack emptySerumArray = GeneticsItems.EMPTY_GENOME.get(1);
        ItemStack resultSerumArray = new ItemStack(items.itemSerumArray, 1, OreDictionary.WILDCARD_VALUE);
        IStackHelper stackHelper = GeneticsJeiPlugin.jeiHelpers.getStackHelper();
        List<ItemStack> subtypes = stackHelper.toItemStackList(resultSerumArray);
        List<ItemStack> resultSerumArrays = new ArrayList<>();
        for (ItemStack subtype : subtypes) {
            subtype = subtype.copy();
            subtype.setItemDamage(subtype.getMaxDamage());
            resultSerumArrays.add(subtype);
        }
        recipes.add(new DatabaseRecipeWrapper(emptySerumArray, resultSerumArrays));
    }
    return recipes;
}
Also used : ArrayList(java.util.ArrayList) ModuleItems(binnie.genetics.item.ModuleItems) List(java.util.List) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) IStackHelper(mezz.jei.api.recipe.IStackHelper)

Aggregations

IStackHelper (mezz.jei.api.recipe.IStackHelper)9 ItemStack (net.minecraft.item.ItemStack)9 ArrayList (java.util.ArrayList)6 List (java.util.List)4 ImmutableList (com.google.common.collect.ImmutableList)2 NonNullList (net.minecraft.util.NonNullList)2 ModuleItems (binnie.genetics.item.ModuleItems)1 IGuiHelper (mezz.jei.api.IGuiHelper)1 ChoppingBlockRecipe (se.gory_moon.horsepower.recipes.ChoppingBlockRecipe)1 GrindstoneRecipe (se.gory_moon.horsepower.recipes.GrindstoneRecipe)1 PressRecipe (se.gory_moon.horsepower.recipes.PressRecipe)1