Jump to content

Recommended Posts

Posted (edited)

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 by Maciej916
Posted

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.

Posted
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"));

 

Posted (edited)
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 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.

Posted
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.