Posted September 2, 201312 yr Hi, I am just wondering how you would go about Crafting Handlers to make them only apply to recipes in the vanilla workbench. Like one item getting damaged if used in a recipe in the vanilla workbench and just getting destroyed when used in a custom workbench recipe.
September 2, 201312 yr Author I have made a item that I use in recipes and each time it is used it gets damaged, but only when used in the vanilla crafting table. When I use it in a recipe in my custom crafting table I want it to get destroyed.
September 2, 201312 yr Author There is no need for a CraftingHandler there. Use Item#getContainerItemStack. Then make your own SlotCrafting and don't call that method from there. Could you please give me an example in a recipe?
September 2, 201312 yr Author I take that back, now I can't use the item when it is damaged in the recipe.
September 2, 201312 yr Author Like GameRegistry.addShapelessRecipe(output, input1, new ItemStack(item, 1, OreDictiornary.WILDCARD_VALUE).setContainerItem(containerItem); ?
September 2, 201312 yr Test it and check yourself? If you guys dont get it.. then well ya.. try harder...
September 2, 201312 yr Author I made it work like this : int i = OreDictionary.WILDCARD_VALUE; Item gem = duplicatorGem.setContainerItem(duplicatorGem); GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 2, 0), new ItemStack(Item.coal, 1, 0), new ItemStack(stack, 1, i)); How does that look?
September 2, 201312 yr This turns out to be a better way than using a CraftingHandler, which is what I had also been doing and advising others to do. I worked it out from someone else's code, somewhere, and it worked, so I had no reason to suspect it was not the "right" way to do ti. What's wrong with using the CraftingHandler, anyway? There really needs to be a "Best Practices" guide for Forge, because one really has no way of knowing if someone else's code that one is learning from is good code or not. Or is modding like Perl: "There's more than one way to do it"? Now, on to a related problem: if a tool is not consumed by a recipe (because of hasContainerItem()/getContainerItemStack()), how do you keep the repair function of the crafting table from turning into a tool duping machine? Stuff I maintain: https://minecraft.curseforge.com/members/sinhika/projects Repositories: https://github.com/Sinhika?tab=repositories
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.