Posted August 9, 201510 yr I have an item that takes damage when you use it to craft things. The problem is when I put 2 of them in a crafting table (like in vanilla how you can combine them for more durability), this happens: I can just keep crafting them. Here is the item class: http://pastebin.com/p3EYBhU8
August 9, 201510 yr Author Well, yes of course you can. You specified for them to have a container item... Is there a way to make it so it does take damage but does not do the thing I described? I changed so it doesn't have a container item, but it doesn't take damage,. It takes the whole item.
August 9, 201510 yr Author Ok, please describe exactly what you want to happen, I am having difficulty understanding what you want. The hammer is used in crafting. It takes durability when you use it while crafting. That works. If you take 2 tools in vanilla and put the together, they both combine. If you take 2 hammers and put them together, they just keep making more. This is what I mean: https://gyazo.com/9f72ca4eac19b6480703d6334948fbff It just lets me make more. I was wondering how do I not make it repairable like that?
August 9, 201510 yr Author I see. So you want it to have a container item in one recipe but not in the other. You will have to make a custom IRecipe then and override getRemainingItems in there. The easiest would be to extend ShapedOreRecipe and just override that one method. I override getRemainingItems, but what do I put in there? I have: @Override public ItemStack[] getRemainingItems(InventoryCrafting p_179532_1_) { return null; } I'm still kinda new to programming so please excuse me.
August 9, 201510 yr Author Look at the default implementation (e.g. ForgeHooks.defaultRecipeGetRemainingItems) and modify it for your needs. I found it. But I never worked with inventory things before. public static ItemStack[] defaultRecipeGetRemainingItems(InventoryCrafting inv) { ItemStack[] ret = new ItemStack[inv.getSizeInventory()]; for (int i = 0; i < ret.length; i++) { ret[i] = getContainerItem(inv.getStackInSlot(i)); } return ret; } That is what I found. The only part I don't understand is what do I need to change?
August 10, 201510 yr Author Do you understand what the code does? Then explain it to me in your own words. Do not just read out line by line the code. Explain the function of the code itself. I guess I don't know that much of java. I understand some of it.
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.