Damage immunity

Started by xXMoksXx on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Damage immunity

I want to make an item that will give immunity to a certain type of damage, could you tell me how to create such a procedure?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If this worked, it doesn't…
Tue, 06/03/2025 - 05:05

If this worked, it doesn't anymore.  

I also tried that but with "cancel event that caused global trigger".  

It worked perfectly in 1.20.1, the entity/player becomes immune to that damage, nothing happens when being attacked by it.  

But after updating to 1.21.1 the procedure refuses to compile if there is "cancel event that caused global trigger" in it, even if the global trigger specifically states it is cancellable and there are no warnings.  

I still did not find a way to replace it. Setting health to "current health + damage taken" simply doesn't work (doesn't do anything, the damage is dealt normally and no healing happens after).  

Now I just tried with this return false and it doesn't do anything either, the damage happens normally.