Use default strategy if the attack strategy returns false

This commit is contained in:
fullwall 2013-08-02 13:49:53 +08:00
parent 7911d70c73
commit 8457671a6e

View File

@ -121,6 +121,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
if (aggro && canAttack()) {
AttackStrategy strategy = parameters.attackStrategy();
if (strategy != null && strategy.handle((LivingEntity) handle.getBukkitEntity(), getTarget())) {
} else if (strategy != parameters.defaultAttackStrategy()) {
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(), getTarget());
}
attackTicks = ATTACK_DELAY_TICKS;
}