Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

remove "--stack.stackSize", this means that your stacksize will reduce.

And your item will disappear if you are not more carrying than one.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.