Carpet

Carpet

2M Downloads

Suggestion: Add a method to set an entity's current target

James103 opened this issue ยท 1 comments

commented

What if there was a method to set and reset an entity's current target? For example, you could make Zombies attack other zombies, or ghasts shoot at creepers, or many more combinations.

The method would be modify(e, 'target', target), which would set the current target of the entity e to the specified target. This does one of two things:

  • The entity e will attack or follow the specified target, if target is another entity.
  • Optional: The entity e will pathfind towards the specified target, if target resolves to some coordinates.
commented

I had that at some point - problem being that target is persistent and only used as part of some AI tasks, so mobs that usually wouldn't attack anything wouldn't attack anything either, and mobs that would attack other mobs would keep attacking the other indicted mob even after they are dead. I removed that from the API, with a note that it requires much more work (i.e. custom AI tasks), which is much more work.