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
[1.12.2] How to add recipes to Metal Former via api?
-
-
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: IMachineRecipeManagerboolean 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:
Javaimport 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.