[1.12.2] How to add recipes to Metal Former via api?

  • Hello, I don't know how to add recipes via api. All tutorials are outdated and it isn't working. I have downloaded ic2 api via build.gradle into eclipse

    • Official Post

    The metal former recipes are accessed via three fields in ic2.api.recipe.Recipes: metalformerExtruding, metalformerCutting and metalformerRolling. The method you'll want to be using is

    Java: IMachineRecipeManager
    boolean addRecipe(IRecipeInput input, Collection<ItemStack> output, NBTTagCompound metadata, boolean replace);

    The input type you can create using the IRecipeInputFactory instance inputFactory in Recipes, the output is just a list with a single ItemStack for what you want the recipe to produce, metadata can be null for a metal forming recipe, and replace is optional for if you want to override a pre-existing recipe. For a simple example, adding a rolling recipe turning an apple into stone, you'd do:

    Java
    import java.util.Collections;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import ic2.api.recipe.IRecipeInput;
    import ic2.api.recipe.Recipes;
    
    IRecipeInput input = Recipes.inputFactory.forStack(new ItemStack(Items.APPLE));
    ItemStack output = new ItemStack(Blocks.STONE);
    Recipes.metalformerRolling.addRecipe(input, Collections.singletonList(output), null, false);

    For the different input options like ore dictionary support, fluid containers, multiple items per recipe, or various different items to produce the same output, take a look at ic2.api.recipe.IRecipeInputFactory.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.