Posted February 2, 20205 yr Hello Im trying to generate json recepies by using Receipe Provider and everything is working fine but when I want to add another recipe for same item is show "Duplicate recipe..." error. I want to add crafting and smelting recipe and second one will throw duplicate error. Im just started to use this method so probably it's easy to fix. protected void registerRecipes(Consumer<IFinishedRecipe> consumer) { ShapedRecipeBuilder.shapedRecipe(ModItems.COPPER_INGOT.get(), 9) .patternLine("x ") .key('x', ModBlocks.COPPER_BLOCK.get()) .setGroup(MODID) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_BLOCK.get())) .build(consumer); CookingRecipeBuilder.smeltingRecipe(Ingredient.fromItems(ModBlocks.COPPER_ORE.get()), ModItems.COPPER_INGOT.get(), 0.6f, 200) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_ORE.get())) .build(consumer); } Error: Caused by: java.lang.IllegalStateException: Duplicate recipe indreb:copper_ingot Edited February 2, 20205 yr by Maciej916
February 2, 20205 yr Use the build overload that takes a ResourceLocation argument to change the name of the generated recipe. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 2, 20205 yr Author 8 minutes ago, Choonster said: Use the build overload that takes a ResourceLocation argument to change the name of the generated recipe. Thank you it worked CookingRecipeBuilder.smeltingRecipe(Ingredient.fromItems(ModBlocks.COPPER_ORE.get()), ModItems.COPPER_INGOT.get(), 0.6f, 200) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_ORE.get())) .build(consumer, new ResourceLocation("copper_ingot_smelting"));
February 2, 20205 yr 1 hour ago, Maciej916 said: Thank you it worked CookingRecipeBuilder.smeltingRecipe(Ingredient.fromItems(ModBlocks.COPPER_ORE.get()), ModItems.COPPER_INGOT.get(), 0.6f, 200) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_ORE.get())) .build(consumer, new ResourceLocation("copper_ingot_smelting")); That code creates the recipe in the minecraft namespace, you should use your mod ID as the namespace of the ResourceLocation (i.e. call the two-argument overload of the ResourceLocation constructor). Edited February 2, 20205 yr by Choonster Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 3, 20205 yr Author On 2/2/2020 at 2:40 PM, Choonster said: That code creates the recipe in the minecraft namespace, you should use your mod ID as the namespace of the ResourceLocation (i.e. call the two-argument overload of the ResourceLocation constructor). Oh didn't know about that ty again new ResourceLocation(MODID,"...")
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.