Posted July 27, 201312 yr Basically I was using code from inside this thread, to make items getting damaged when used in certain crafting recipes. This turned out to be working very good, but unfortunately rendered one nasty bug, that I can't get seem to get solved. What happens if I use two of the same damageable items in the crafting menu, it will craft the same item, see this picture to understand what I mean: What you see in the picture is a mortar and pestle that should regularily be used to crush sugar cane, which, like mentioned before, works perfectly fine. But getting an undamaged item out of crafting the item with itself, was not exactly what I wanted. It does not matter if I use two damaged or two undamaged items, or combine damaged and undamaged items, it does however, not do that when I put more then two item into the crafting menu. Here's the code I'm using... Item: package MetallurgyRealism; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; public class ToolMortarPestle extends Item { public ToolMortarPestle(int id) { super(id); this.setMaxStackSize(1); this.setMaxDamage(10); this.setCreativeTab(MetallurgyRealismModBase.MetallurgyRealismTab); this.setUnlocalizedName("mortarpestle"); } public String getTextureFile() { return CommonProxy.ITEMS_PNG; } public void registerIcons(IconRegister iconRegister) { itemIcon = iconRegister.registerIcon("MetallurgyRealism:mortarpestle"); } @Override public boolean hasContainerItem() { return true; } @Override public ItemStack getContainerItemStack(ItemStack itemStack) { itemStack.setItemDamage(itemStack.getItemDamage() + 1); return itemStack; } } Main Class: ToolMortarPestle = new ToolMortarPestle(ToolMortarPestleID).setContainerItem(ToolMortarPestle); GameRegistry.addShapelessRecipe(new ItemStack(Item.sugar, 3), new ItemStack(Item.reed), new ItemStack(ToolMortarPestle, 1, OreDictionary.WILDCARD_VALUE)); Any idea?
July 27, 201312 yr Author That's the repair recipe function of the Crafting system (you can combine two damaged Items). To disable use setNoRepair on your item. So items will always repair themselfs if not the setNoRepair flag set? Interesting. I'd swear I haven't noticed that before. However, works brilliantly perfect now. Thank you very much friend.
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.