Posted May 8, 20241 yr Hi, I'm trying to use datagen to create json files in my own mod. This is my ModRecipeProvider class. public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.COMPRESSED_DIAMOND.get()) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get(),9) .requires(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .unlockedBy(getHasName(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()), has(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get())) .save(pWriter); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', Blocks.DIAMOND_BLOCK) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); } } When I try to run the runData client, it shows an error: Caused by: java.lang.IllegalStateException: Duplicate recipe compressed:compressed_diamond I know that it's caused by the fact that there are two recipes for the ModItems.COMPRESSED_DIAMOND. But I need both of these recipes, because I need a way to craft ModItems.COMPRESSED_DIAMOND_BLOCK and restore 9 diamond blocks from ModItems.COMPRESSED_DIAMOND. Is there a way to solve this?
May 9, 20241 yr Author 10 hours ago, AwesomeDev said: Just change the recipe names so they aren't the same Thank you. It's fixed now😃.
May 9, 20241 yr Advice for the future: I made functions to create recipes more easily; they generate names for the recipes based on the ingredients and the result.
September 2, 20241 yr On 5/8/2024 at 7:49 PM, AwesomeDev said: Just change the recipe names so they aren't the same How would you do that? I'm on 1.20.1 Edited September 2, 20241 yr by Miles5291 Added more detail.
September 2, 20241 yr 14 hours ago, Miles5291 said: How would you do that? I'm on 1.20.1 When you save the recipe using .save(pWriter), give the name of the recipe as well: .save(pWriter, "yourNameHere")
September 2, 20241 yr 3 hours ago, scientistknight1 said: When you save the recipe using .save(pWriter), give the name of the recipe as well: .save(pWriter, "yourNameHere") Thanks 👍
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.