How can I test for a potion effect on player?

Started by Distru121mods on

Topic category: Help with MCreator software

Last seen on 12:15, 20. Dec 2022
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I test for a potion effect on player?

I would like to make a gun that, when used, removes blindness from the player and does things, but ONLY if the player has already blindness on!

I can't find any code in the procedures that can make me test if the player have a potion effect on, maybe a snippet code?

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
EntityLivingBase…
Mon, 03/04/2019 - 17:50

EntityLivingBase#isPotionActive() is what you need. It takes a parameter of type MobEffect

Edited example from Minecraft vanilla code:

if(this.isPotionActive(MobEffects.FIRE_RESISTANCE)){
//do stuff
}

 

Last seen on 12:15, 20. Dec 2022
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you very much! I had…
Mon, 03/04/2019 - 19:06

Thank you very much! I had to figure out where to put it, because i'm still pretty new to this type of coding, but now it works!

Last seen on 17:56, 12. Jan 2021
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know that these is old but…
Fri, 05/15/2020 - 12:10

I know that these is old but... How can i apply the code to my Mcreator event? help pls.