Prevent Iron Golem from attacking player

Started by OkayOak on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Prevent Iron Golem from attacking player

I have an item designed to heal the player and heal entities the player hits with the item, however if the player hits a villager or an iron golem they will be attacked by the golem. Is it possible to prevent this from happening?

Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Depending on how you…
Sat, 08/05/2023 - 23:06

Depending on how you register the hit and stuff, possibly cancel the damage event and only heal?

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This helped a lot. Thanks!…
Sun, 08/06/2023 - 13:24

This helped a lot. Thanks!

For anyone looking for a solution: I used the global event 'Entity attacked', and set the damage event to cancel only when the player is holding the item.