Posted February 25, 201411 yr 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; } } } }
February 25, 201411 yr I don't know why.. I should work! Do you really changed it to this? player.getCurrentArmor(0);
February 26, 201411 yr 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. http://i.imgur.com/NdrFdld.png[/img]
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.