Don't cancel pathfinding when despawned

This commit is contained in:
fullwall 2013-02-04 10:14:50 +08:00
parent 23fab58673
commit fee41a4a00

View File

@ -101,10 +101,8 @@ public class CitizensNavigator implements Navigator, Runnable {
public void run() { public void run() {
if (!isNavigating()) if (!isNavigating())
return; return;
if (!npc.isSpawned()) { if (!npc.isSpawned())
stopNavigating(CancelReason.NPC_DESPAWNED);
return; return;
}
if (updateStationaryStatus()) if (updateStationaryStatus())
return; return;
updatePathfindingRange(); updatePathfindingRange();
@ -154,9 +152,9 @@ public class CitizensNavigator implements Navigator, Runnable {
} }
localParams = defaultParams.clone(); localParams = defaultParams.clone();
PathStrategy newStrategy; PathStrategy newStrategy;
if (Setting.USE_NEW_PATHFINDER.asBoolean()) if (Setting.USE_NEW_PATHFINDER.asBoolean()) {
newStrategy = new AStarNavigationStrategy(npc, target, localParams); newStrategy = new AStarNavigationStrategy(npc, target, localParams);
else } else
newStrategy = new MCNavigationStrategy(npc, target, localParams); newStrategy = new MCNavigationStrategy(npc, target, localParams);
switchStrategyTo(newStrategy); switchStrategyTo(newStrategy);
} }