Posted December 22, 20177 yr Hey guys, I now have plans for my new armor, yet I don't know how to add potion effects from it. onItemRightClick() is this the method should I override? also, I am scared because what if I added potion effects from it then I set the time for like 1 minutes, then after that the effects would wear off, the player would need to reequip the armor to have that effects again yet it's annoying.
December 22, 20177 yr Subscribe to the PlayerTick event, and check if the player has the armour equipped. If so, give the player a potion effect for 1-2 ticks (higher for nightvision/nausea (effect flickers as it ends) etc) Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
December 22, 20177 yr Check this test from choonster. Might be just what you need (should work for 1.10/1.11 but it's 1.12 branch): https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.12.2/src/main/java/choonster/testmod3/item/ItemArmourPotionEffect.java. Also check the Forge LivingEquipmentChangeEvent for 1.12 (I don't know if it exists for 1.10). HTH.
December 23, 20177 yr Author 5 hours ago, Matryoshika said: Subscribe to the PlayerTick event, and check if the player has the armour equipped. If so, give the player a potion effect for 1-2 ticks (higher for nightvision/nausea (effect flickers as it ends) etc) how do I make it for unlimited time.
December 23, 20177 yr You cannot. You can either: apply the potion with 1~2 seconds left, and re-apply it every tick or apply the potion with Integer#MAX_VALUE as time, but this means that you have to also check if the player ISN'T wearing your armour. This can also lead to false positives in which the player gets the effect from another source, but you might remove it still, because the player doesn't have your armour... You can add a method in your ClientProxy, supplying the PotionEffect that (will be/has been) added to the player, and in said method call PotionEffect::setPotionDurationMax(true). This only affects the timer cosmetically, making whatever time is left look like **:**. Edited December 23, 20177 yr by Matryoshika Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
December 23, 20177 yr Author Just now, Matryoshika said: You cannot. You can either: apply the potion with 1~2 seconds left, and re-apply it every tick or apply the potion with Integer#MAX_VALUE as time, but this means that you have to also check if the player ISN'T wearing your armour. This can also lead to false positives in which the player gets the effect from another source, but you might remove it still, because the player doesn't have your armour... You can add a method in your ClientProxy, supplying the PotionEffect that (will be/has been) added to the player, and in said method call PotionEffect::setPotionDurationMax(true). This only affects the timer cosmetically, making whatever time is left look like **:**. Thanks, other question, how do I make it like RESITANCE II or ABSORPTION III
December 23, 20177 yr new PotionEffect(MobEffects#RESISTANCE, duration, level)... A very simple glance at the PotionEffect constructors could have told you that... Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
December 24, 20177 yr Author Just now, diesieben07 said: Use one of the PotionEffect constructors that has an amplifier parameter. oh so that what amplifier means?
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.