Posted July 17, 201411 yr Okay. I've tried everything, and I cannot figure out what I'm doing wrong. This seems like the only help there is on this subject: http://pastebin.com/SnPaAvUd, and it doesn't work. Instead of the item being damaged, it gets used up. This is my code that I'm working with: // My item class. public class ItemKnifeBase extends Item { public ItemKnifeBase(ToolMaterial material) { this.setCreativeTab(ToolForgeryMod.tabToolForgery); this.setUnlocalizedName(ToolForgeryMod.MOD_ID + ":knife_" + material.toString().toLowerCase()); this.setTextureName(ToolForgeryMod.RESOURCES_PREFIX + "knife_" + material.toString().toLowerCase()); this.setMaxDamage(material.getMaxUses()); } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack result = itemStack.copy(); result.setItemDamage(result.getItemDamage() + 1); result.stackSize = 1; return result; } @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) { return false; } } // Registering the crafting recipe in the preInit() method. GameRegistry.addShapelessRecipe(new ItemStack(Blocks.planks, 4, 0), new ItemStack(Blocks.log, 1, 0), new ItemStack(TFItems.knife_stone, 1, OreDictionary.WILDCARD_VALUE)); To clarify, the recipe shows up, and I can use it, but instead of damaging the knife, the knife gets used up. And I'm registering the item before the recipe. SOLUTION: You need to add @Override public boolean hasContainerItem() { return true; } to the item's class. if (user.hasKnowledgeOfJava) { if (user.question.hasCode) { return interpetHelpfulResponse(user.getQuestion()); } else { return "Could you post your code please?"; } } else { return "Learn some freaking Java!"; }
July 17, 201411 yr https://github.com/KeeperofMee/ClayMod/blob/master/claymod/items/CmChisel.java btw you might wanna add "this.setNoRepair();" no quotes, otherwise it will be possible to duplicate it forever. If I helped please press the Thank You button.
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.