How can I test for a potion effect on player?

Started by Distru121mods on

Topic category: Help with MCreator software

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?

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
}

 

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!

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.