Posted December 24, 201410 yr I am creating a Magic Wands mod, and one of the wands (the Ice Wand) can only be used once, and then disappears from your inventory. I have tried everything I know to make this Wand have infinite uses, but I can't seem to fix the problem. Here is the code I am using: public class ItemIceWand extends Item{ public static final String modid = "Examplemod"; public ItemIceWand(){ this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabTools); this.setTextureName("Examplemod:MagicWand"); this.setUnlocalizedName("Ice Wand"); } public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ if(par7 != 1){ return false; }else{ if(player.canPlayerEdit(x, y + 1, z, par7, stack) && player.canPlayerEdit(x, y + 2, z, par7, stack)){ world.setBlock(x, y, z, Blocks.ice); world.notifyBlockOfNeighborChange(x, y + 1, z, Blocks.ice); world.notifyBlockOfNeighborChange(x, y + 2, z, Blocks.ice); --stack.stackSize; } } return bFull3D; } } Thanks in advance for any help you can give me.
December 24, 201410 yr remove "--stack.stackSize", this means that your stacksize will reduce. And your item will disappear if you are not more carrying than one.
December 24, 201410 yr Author Thank you so much! I removed --stack.stackSize, and it worked perfectly!
December 24, 201410 yr I think bFull3D was the return his IDE used to auto-complete his method I think he is a beginnen because he didn't find his problem himself and what diesieben said.
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.