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

hey, i updated my mod to 1.7.2, it had a armor effect function

but it doesnt work anymore

 

public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack)

{

ItemStack flipper = player.getCurrentArmor(1);

 

if (flipper != null )

{

if (flipper.getItem() == armorMod.Flippers)

{

if (player.isInWater())

{

player.motionX *= 1.2;

player.motionZ *= 1.2;

player.jumpMovementFactor *= 1.2;

}

else

{

player.motionX *= 0.2;

player.motionZ *= 0.2;

}

}

}

}

onArmorTickUpdate was renamed to onArmorTick. Seriously people, use the @Override annotation. It's one simple line for a whole lot of error protection.

 

Also, the ticking armor is only called when you are wearing the item, and it's called for that item, so you don't need to getCurrentArmor or null check unless you are checking slots other than the one ticking. You can even do this:

 

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (this == armorMod.Flippers) {
// do stuff
}
}

That's the beauty of non-static class methods - they can only be called with an actual object of that class, so you are always safe from null and can use "this", because the Item in question is the one calling the method.

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.