Mob still gives debuff effect when I use Shield (2025.3)

Started by BryAstro on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mob still gives debuff effect when I use Shield (2025.3)

Hello, I'm trying to make it so that if a shield blocks the player from taking damage from my custom mob, the player won't receive the negative potion effect.

So far, the procedure is like so:

Entity is hurt

 if Is [Source entity] (sub)type of CUSTOM MOB do

  Add potion DEBUFF with level 0 for 100 ticks to [Event/target entity]

The mob gives the debuff just fine, but the problem is even if I block the attack with a shield, it will still give me that debuff.

And if I make the code like so:

Entity is hurt

 if not Is [Event/target entity] blocking

  if Is [Source entity] (sub)type of CUSTOM MOB do

   Add potion DEBUFF with level 0 for 100 ticks to [Event/target entity]

Then it will never give me the debuff if I use my shield, even if I look the other way so that the mob still damages me.

The two extremes seemingly being the only two options I can pick at the moment is the problem, is there a way to make it work properly so that if the attack is blocked, then the debuff will not go through the shield (but only as long as the attack is completely blocked)?

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe check (via a variable…
Thu, 01/01/2026 - 19:53

Maybe check (via a variable or smth.) if the player got damaged? Would be the only thing I can think off rn, unless you want to do some maths with blocking rotation

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I had a very similar problem…
Sat, 01/03/2026 - 06:19

I had a very similar problem, but I managed to fix it.

You may keep the Event Trigger as "Entity is hurt".

The first thing that your procedure must do is to get your current health. It is counterintuitive, but this checks entities' health before they actually get damaged, since the procedure triggers before the damage applies.

Then, add a 1 tick delay. After that, subtract ([previous health] - [new current health]), and this way you can tell if you actually took damage.