Xander402 Posted February 18, 2019 Posted February 18, 2019 (edited) Hello, I added a utility item that is meant to "consists of" two other items. It's crafted like this: GameRegistry.addShapelessRecipe( new ResourceLocation("modid:itemA_and_itemB_merge"), null, new ItemStack(ItemInit.ITEM_A_AND_ITEM_B, 2), Ingredient.fromItem(ItemInit.ITEM_A), Ingredient.fromItem(ItemInit.ITEM_B) ); But I also want to make it uncraftable without any uncrafting table mod. I tried this: GameRegistry.addShapelessRecipe( new ResourceLocation("modid:itemA_and_itemB_separate"), null, new ItemStack(ItemInit.ITEM_A, 1), Ingredient.fromItem(ItemInit.ITEM_A_AND_ITEM_B .setContainerItem(ItemInit.ITEM_B)), Ingredient.fromItem(ItemInit.ITEM_A_AND_ITEM_B) ); Where only one ITEM_A_AND_ITEM_B is meant to change to ITEM_B after grabbing ITEM_A from the crafting output. But instead, both of the ITEM_A_AND_ITEM_B-s change to IITEM_B...: I also just noticed that the ITEM_A_AND_ITEM_B gets changed into ITEM_B after grabbing the output in every recipe that I've added --- So, how can I make it work as I want? Thanks in advance! Edited February 18, 2019 by Xander402 +anotherBug Quote A few bytes about me: public class Xander402 extends Modder implements IForumMember { int javaExperience, moddingExperience; LearningWay preferredLearningWay; public Xander402() { this.javaExperience = BIG; this.moddingExperience = NOT_SO_BIG; this.preferredLearningWay = LearningWay.through("exampes"); super(/*displayName*/"Xander402", /*moddingSince*/"1.9", preferredLearningWay); } @Override public Goal getReasonOfJoining(Forum forum) { return new Goal(() -> { while (true) moddingExperience++; }); } }
Draco18s Posted February 18, 2019 Posted February 18, 2019 37 minutes ago, Xander402 said: Ingredient.fromItem(ItemInit.ITEM_A_AND_ITEM_B .setContainerItem(ItemInit.ITEM_B)), Wow that's disgusting. This will permanently change the container item (until your recipe comes along and changes it again). Every other recipe using the item will return a copy. That is not how that was ever meant to be used. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Xander402 Posted February 18, 2019 Author Posted February 18, 2019 (edited) 7 minutes ago, Draco18s said: That is not how that was ever meant to be used. Yeah, I know that too, because it simply does what you said: 7 minutes ago, Draco18s said: This will permanently change the container item (until your recipe comes along and changes it again). Every other recipe using the item will return a copy. But I haven't found any other method for putting an item in the crafting grid after grabbing the output, that's just why I used setContainerItem(). I would be happy to know if there is one that would solve my problem. Edited February 18, 2019 by Xander402 Quote A few bytes about me: public class Xander402 extends Modder implements IForumMember { int javaExperience, moddingExperience; LearningWay preferredLearningWay; public Xander402() { this.javaExperience = BIG; this.moddingExperience = NOT_SO_BIG; this.preferredLearningWay = LearningWay.through("exampes"); super(/*displayName*/"Xander402", /*moddingSince*/"1.9", preferredLearningWay); } @Override public Goal getReasonOfJoining(Forum forum) { return new Goal(() -> { while (true) moddingExperience++; }); } }
Cadiboo Posted February 19, 2019 Posted February 19, 2019 Use JSON Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
Choonster Posted February 19, 2019 Posted February 19, 2019 You'll need to create your own IRecipe implementation (optionally extending an existing one like ShapelessRecipes) that implements IRecipe#getRemainingItems to return the appropriate remaining items. You'll also need an IRecipeFactory to parse your recipe from JSON, this needs to be registered in _factories.json. You can see some examples of custom recipes and factories here and the _factories.json file here. Quote 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.
Recommended Posts
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.