[Request-Infos] How to change some recipes ?
Slater022 opened this issue ยท 14 comments
Why ? Because I want to replace osmium by Steel in the recipe of the enriched alloy and increase the redstone used by the recipes ( same for the other alloy recipes ).
I'm actually building a modpack for 1.10 based around Mekanism But i want to slow the progression to have long term goal and one of the thing i'm doing is basically slow the machinary progression till you got railcraft Steel.
( oh, and 'im replacing osmium by steel plates too ^^" and maybe aluminium for high end machinary )
Short desc : A completely different modpack that actually exist ^^' .
Anyway : how , if possible, can i change this kind of recipes ?
Do I need to write myself an addon mod to do that ?
Currently the way of changing recipes is by using IMC (inter mod communications). You can delete and add recipes with it. You need to write yourself an addon mod to do it.
How the IMC messages should look like is explained at:
https://github.com/aidancbrady/Mekanism/wiki/IMC-based-recipe-integration
Thanks for your answer @thommy101 I really appreciate that. Is there any example project i can use to simply use IMC with mekanism ?
I'll try to do that :)
Huuuum ...
NBTTagCompound recipeTag = new NBTTagCompound();
recipeTag.setTag("itemInput", new ItemStack(Blocks.COBBLESTONE).writeToNBT(new NBTTagCompound()));
recipeTag.setTag("itemOutput", new ItemStack(Items.DIAMOND).writeToNBT(new NBTTagCompound()));
FMLInterModComms.sendMessage("Mekanism", "EnrichmentChamberRecipe", recipeTag);
Don't add the recipe in the enrichment chamber ...
Enrichmentchambers use input and output, not itemInput and itemOutput.
There should be a log output which warns you for "unrecognised" IMC messages.
Nope when i run the game from my idea project it's not showing me any output errors for imc :/
Try it with this: (replaced itemInput with input and itemOutput with output)
NBTTagCompound recipeTag = new NBTTagCompound();
recipeTag.setTag("input", new ItemStack(Blocks.COBBLESTONE).writeToNBT(new NBTTagCompound()));
recipeTag.setTag("output", new ItemStack(Items.DIAMOND).writeToNBT(new NBTTagCompound()));
FMLInterModComms.sendMessage("Mekanism", "EnrichmentChamberRecipe", recipeTag);
Already tried ^^
Edit : Wait ... that's working !
How did you find that enrichment chamber needed "input" and "output"? ( i want to avoid to ask you for each single machines. like the metalurgic infuser ^^")
Thanks :)
Edit : To help others I decided to write a mod ( addon ) to mekanism to help people to tweaks recipes based on your help :) then , thks for your help.
I'm lacking concrete example to remove a specific machine's recipe & add an metalurgic infuser recipe.
See the following repository for an example of a Mekanism EnrichmentChamber recipe being added through IMC: https://github.com/thommy101/MekanismIMC
There should be a log entry with the following:
[Mekanism] mekanismimc added recipe of type EnrichmentChamber to the recipe list.
After adding the mod, putting a cobblestone in the enrichment chamber gives me a diamond as result.
I'm trying with that but not working :
String infusionType = "REDSTONE";
int infusionAmount = 20;
ItemStack input = new ItemStack(Blocks.COBBLESTONE);
ItemStack output = new ItemStack(Items.DIAMOND);
String key = "MetalurgicInfuserRecipe";
//InfusionString = CARBON;TIN;DIAMOND;REDSTONE;FUNGI;BIO;OBSIDIAN
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
nbt.setTag("infuseType", new NBTTagString(infusionType));
nbt.setTag("infuseAmount", new NBTTagInt(infusionAmount));
nbt.setTag("output", output.writeToNBT(new NBTTagCompound()));
FMLInterModComms.sendMessage("Mekanism", key, nbt);
Consider reading this: https://github.com/aidancbrady/Mekanism/wiki/IMC-based-recipe-integration
@thommy101 Thanks for example you rock ! but recipes don't show in the JEI.
@aidancbrady Yeah Believe me I read that.
It work now. But Recipes are not showed in JEI.
Someone tell me to use that way to do that :
-Add mekanism as a dependency
-Add build a simple mod with that :
@EventHandler
public void init(FMLInitializationEvent event) {
RecipeHandler.Recipe.METALLURGIC_INFUSER.get().clear();
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 50, new ItemStack(MekanismItems.EnrichedAlloy), new ItemStack(MekanismItems.ControlCircuit, 1, 0));
}
It work too when i launch the client but I can't remove existing recipes like this one :
@EventHandler
public void init(FMLInitializationEvent event) {
RecipeHandler.Recipe.METALLURGIC_INFUSER.get().clear();
//Recipe in Mekanism.java
// RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("REDSTONE"), 10, new ItemStack(Items.IRON_INGOT), new ItemStack(MekanismItems.EnrichedAlloy));
this.removeMetallurgicInfuserRecipe(InfuseRegistry.get("REDSTONE"), 10, new ItemStack(Items.IRON_INGOT), new ItemStack(MekanismItems.EnrichedAlloy));
//workink added recipes
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 50, new ItemStack(MekanismItems.EnrichedAlloy), new ItemStack(MekanismItems.ControlCircuit, 1, 0));
}
public void removeMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output) {
RecipeHandler.removeRecipe(RecipeHandler.Recipe.METALLURGIC_INFUSER, new MetallurgicInfuserRecipe(new InfusionInput(infuse, amount, input), output));
}
The Recipe added is working, but the removed is still here.