Entity that switches between melee and ranged attacks

Started by leliloni on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity that switches between melee and ranged attacks

I am trying to make a ranged mob that will only shoot at its target when it is further away. If the target comes closer, the mob should attack it with a normal melee attack. Is there a way to do this?

(I am willing to code if there is no other option, but I don‘t have any experiece with it, so I would need a detailed explanation).