How can I check if an entity has a status effect?

Started by Tiny Desk Engineer on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I check if an entity has a status effect?

I'm trying to create a potion effect that prevent any entity that has it from taking any damage whatsoever, until the effect runs out. Like a really high level of Resistance. I think canceling any "Before entity is hurt" events on any entity with the effect would do what I want it to do, but I can't figure out how to check if the entity actually has the effect.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just use an if bracket, and…
Wed, 12/27/2023 - 06:47

Just use an if bracket, and the 'does entity have potion effect' logic function. It's in the entity data tab. You could also use the 'remaining ticks of potion effect' number function. Canceling the 'before entity is hurt' event should work.