Check pathfinding range while pathfinding

This commit is contained in:
fullwall 2016-09-05 19:13:01 +08:00
parent 417f0f1691
commit b5c433c594

View File

@ -148,6 +148,10 @@ public class CitizensNavigator implements Navigator, Runnable {
updateMountedStatus(); updateMountedStatus();
if (!isNavigating() || !npc.isSpawned() || paused) if (!isNavigating() || !npc.isSpawned() || paused)
return; return;
if (Math.pow(localParams.range(), 2) < npc.getStoredLocation().distanceSquared(getTargetAsLocation())) {
stopNavigating(CancelReason.STUCK);
return;
}
if (updateStationaryStatus()) if (updateStationaryStatus())
return; return;