Explicitly shutdown the navigator

This commit is contained in:
fullwall 2012-09-03 15:58:21 +08:00
parent 5dd6b6d6b2
commit 8391b793ef
4 changed files with 14 additions and 1 deletions

View File

@ -129,6 +129,8 @@ public class CitizensNavigator implements Navigator {
} }
private void stopNavigating() { private void stopNavigating() {
if (executing != null)
executing.stop();
executing = null; executing = null;
localParams = defaultParams; localParams = defaultParams;
} }

View File

@ -41,6 +41,11 @@ public class MCNavigationStrategy implements PathStrategy {
return TargetType.LOCATION; return TargetType.LOCATION;
} }
@Override
public void stop() {
navigation.g();
}
@Override @Override
public boolean update() { public boolean update() {
navigation.a(parameters.avoidWater()); navigation.a(parameters.avoidWater());

View File

@ -60,6 +60,11 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
return aggro; return aggro;
} }
@Override
public void stop() {
navigation.g();
}
@Override @Override
public boolean update() { public boolean update() {
if (target == null || target.dead) if (target == null || target.dead)
@ -83,7 +88,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
return false; return false;
} }
private static final int ATTACK_DELAY_TICKS = 20; private static final int ATTACK_DELAY_TICKS = 20;
private static final double ATTACK_DISTANCE = 1.75 * 1.75; private static final double ATTACK_DISTANCE = 1.75 * 1.75;

View File

@ -9,5 +9,7 @@ public interface PathStrategy {
TargetType getTargetType(); TargetType getTargetType();
void stop();
boolean update(); boolean update();
} }