Posted October 21, 201212 yr Howdy I'm attempting to create a Tool that, when it destroys a Block, has a random chance of turning itself into a different Item with the same damage value. Here's the command within the ItemSharpAxe class public ItemStack onBlockDestroyedBy(ItemStack var1, World var2, int var3, int var4, int var5, int var6, EntityPlayer var7) { Random var8 = new Random(); for (int i = 0; i < 1; i++) {int var9 = var8.nextInt(31);} int var10 = var1.getItemDamage(); //int var11 = var1.itemID == mod_SharpenedTools.SharpStoneAxe.shiftedIndex ? ItemTool.axeStone.shiftedIndex : (var1.itemID == mod_SharpenedTools.SharpIronAxe.shiftedIndex ? ItemTool.axeSteel.shiftedIndex : (var1.itemID == mod_SharpenedTools.SharpGoldAxe.shiftedIndex ? ItemTool.axeGold.shiftedIndex : (var1.itemID == mod_SharpenedTools.SharpDiamondAxe.shiftedIndex ? ItemTool.axeDiamond.shiftedIndex: 0))); int var12 = var7.inventory.currentItem; ItemStack var13 = new ItemStack(var11, 1, var10); if (var10 == 0) { --var1.stackSize; ItemStack var13 = new ItemStack(Item.axeSteel.shiftedIndex, 1, var10); var7.inventory.addItemStackToInventory(var13); } return var1; } I've tried various different setups that I was thinking would swap the currently in-use ItemSharpTool for its respective Vanilla tool, but to no avail. I'm not ACTUALLY convinced that it's necessary to be within an onBlockDestroyedBy command. Any help with this?
October 21, 201212 yr What version of Forge are you using? I don't have an onBlockDestroyBy function for Items. Also, what is the issue? Crashing? Nothing happening? http://www.minecraftforum.net/topic/1522738-132-forge-425-gokimods/
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.