Lycarah Posted August 24, 2015 Posted August 24, 2015 Hey guys, at first: Sry if my english is bad (i'm just a german ). I want to make an crafting recipe (shaped or shapeless doesnt matter) where the item i put in don't loose, or tat i get another item back on the crafting table like the cake recipe where you put a milk bucket in and get the empty bucket back. Something like that, i hope you can understand me. I know how to make normal crafting recipes (shaped and shapeless), but i dont know how i should do THIS I hope you can help me Quote
Choonster Posted August 24, 2015 Posted August 24, 2015 If it's your own item that should give something back, you need to use the container item system. I've written an example of an unbreaking container item (never breaks) and a breaking container item (breaks after a fixed number of uses). You can see how to use them in recipes here. These examples are for 1.7.10, but should work in 1.8 as well. 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.
Lycarah Posted August 24, 2015 Author Posted August 24, 2015 Yeah, i have created an one item so i know how to use this ContainerItem on my one items, but i don't know how to use that on vanilla items (or blocks) I know, that could be (or is) silly Quote
Choonster Posted August 24, 2015 Posted August 24, 2015 You'll probably need to make your own recipe class that implements IRecipe (extending an existing implementation will simplify things) and override IRecipe#getRemainingItems to return an array containing the container item for each slot (if any) and your custom remaining item for any slot containing the appropriate vanilla item. ForgeHooks.defaultRecipeGetRemainingItems will create and fill an array of the container items, so you can just search for the vanilla item. If you extend an existing shaped/shapeless recipe class, you can probably just call super.getRemainingItems instead of the ForgeHooks method. Make sure you register your recipe class with RecipeSorter.register . 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.
Lycarah Posted August 24, 2015 Author Posted August 24, 2015 Okey, i have tried an own thing...and it worked so i wanna explain how i have done this for anybody who has the same problem, so here it goes: I have made a shapeless crafting recipe where i put my item "braunkohle" in and get an diamond and there will be a stick left, where i have put my item "Braunkohle. It worked for vanilla items only as well, so here is my code so you can see how i have done this: GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond), new ItemStack(braunkohle.setContainerItem(Items.stick))); GameRegistry.addShapelessRecipe(new ItemStack(Items.blaze_rod), new ItemStack(Items.apple.setContainerItem(Items.stick))); Thanks for all, this thread can be closed now PS: Thx Choonster, that works also Quote
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.