MCP - Custom AITask - Stop attack current target

Dear all,

I am currently developing multiple custom AITask to control the behavior of the entities on my server. One of them represents an aggressive behavior. If you come to close to an entity it will attack you. I realized that by a tracking task, which determines the nearest target in a specific range and attacks it. For attacking an entity I am using the following MCP method.

EntityLivingBase livingEntity = (EntityLivingBase) living;
livingEntity.setAttackTarget((EntityLivingBase) playerToAttack));

If the player/entity runs away and didn’t get hit for a certain amount of time the entity should give up the attack und should go back to its spawn location. Unfortunately I can’t find any MCP method to cancel the current attack. The entity is following the player over the whole world. Does anyone know how I can tell the entity to stop chasing his current target?

Regards Sascha