Posted March 26, 20169 yr Good day. I have a problem! When I add the recipe to craft an instrument, it works well. But when I take a damaged tool from the crafting grid disappears Is code of tool: public class Mortar extends Item { public Mortar(String name) { super(); this.setCreativeTab(HighEnergetics.tabHEI); this.setUnlocalizedName(name); this.setMaxDamage( 27 ); this.setMaxStackSize( 1 ); } @Override public ItemStack getContainerItem(ItemStack itemStack ) { itemStack.setItemDamage( itemStack.getItemDamage() + 1 ); return itemStack; } @Override public boolean hasContainerItem(ItemStack stack) { return true; } } And of recipe: GameRegistry.addRecipe(new ItemStack(HEItems.copperDust), new Object[] {"MI", 'M', new ItemStack(HEItems.mortar, 1, OreDictionary.WILDCARD_VALUE), 'I', HEItems.copperIngot}); I want tool like hammer from IC2
March 26, 20169 yr Author And a few information. Then damaged tool is staing in crafting grid, It are the icon and the zero sub.
March 27, 20169 yr That's the method. Remember that you're working with pointers, so you don't want to operate on the input until the product is removed from the output slot. If you act on the original, you could damage it while the output dust is just sitting in the slot waiting to be grabbed (and if the grid is updated every tick, then that might be why your mortar disappeared). The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
March 27, 20169 yr Sorry about that. We may have a language barrier. Make a copy of the item stack using the object's copy method. Manipulate and return the copy. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.