Jump to content

Recommended Posts

Posted

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.

Posted

I think bFull3D was the return his IDE used to auto-complete his method :D

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.