Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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

 

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.

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.