how can i check that i was attacked by entity not by any other sourse?

Started by Kris on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how can i check that i was attacked by entity not by any other sourse?

I was making a mod where i can get Tense points for entity attacking me so i want to know how to check sourse of damage

p.s if somebody know can you tell me what the difference between entity attacked and entity hurt (global triggers) and how they work

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1:  I think "entity attacked…
Thu, 07/24/2025 - 22:35

1:

 I think "entity attacked" would mean something like a zombie attack a villager while "entity hurt" would be villager took fall damage

2: 

trigger: "entity attacked" - if(source entity) is a sub type of "your entity" - do your procedure

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(posting your reply for the…
Fri, 07/25/2025 - 16:35

(posting your reply for the sake of ease)

You explained how it should work but it didnt work i may missunderstand something please can you help me

code:

Event trigger - triggered by external call or when(global trigger):Entity is attacked

if is Event/target entity (sub)type of Mob entity

my code

p.s i tested it without your command and it works with all types of damage so my code is correct

also i have Mcreator version 2025.2

Minecraft mod version 1.21.4 neoforge(21.4.137)

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can you post a picture of…
Fri, 07/25/2025 - 16:43

can you post a picture of your procedure to imgur and provide a link?