check if entity hit another

Started by Lord Makishi on

Topic category: Help with modding (Java Edition)

Last seen on 11:29, 14. Apr 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
check if entity hit another

Hi, i want to check if an custom made entity hit another entity. If yes, the source entity gains an temporary regeneration effect (basically like Lifesteal). I've tried many procedures, but with no success.

Last seen on 15:21, 16. Oct 2023
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can use global trigger…
Sat, 09/24/2022 - 19:23

You can use global trigger Entity Attacked. It provides which entity and by who was attacked.

Then in if block you can try checking if source entity is a (sub) type of your mob -> there's block named something like "is entity (sub) type of".

Last seen on 11:29, 14. Apr 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks, for helping me again…
Sat, 09/24/2022 - 19:29

Thanks, for helping me again, this was the only block i was missing!