Reset Attack Target?

Started by Mindthemoods on

Topic category: Help with modding (Java Edition)

Last seen on 10:38, 22. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Reset Attack Target?

Loving the new pathfinding stuff, but one issue I've come across is a means of resetting an entity's attack target. (That is, not changing it, but rather setting it back to noone.) Attempting to set the attack target to a null entity produces a compilation error, and attempting to stop navigation temporarily stops the entity's pathfinding, but does not affect the attack target, resulting in it still moving slowly towards the source.

In short, I'm looking for a means of returning an entity to a neutral state under various conditions. Is there something I'm missing, or should I just bite the bullet and try to code this?

Last seen on 10:38, 22. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The current system I'm using…
Sun, 03/26/2023 - 18:49

The current system I'm using is to simply spawn an invisible/insubstantial entity at the position of the attacker, set the attack target to the invisible entity, and then despawn the invisible entity. This works, of course, but it's hardly the most elegant solution.