Also make guided waypoints reset when chagned

This commit is contained in:
fullwall 2022-02-20 11:19:05 +08:00
parent b56a1f85e1
commit 65c7e7c28c

View File

@ -243,6 +243,9 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
tree.put(new long[] { waypoint.getLocation().getBlockX(), waypoint.getLocation().getBlockY(),
waypoint.getLocation().getBlockZ() }, waypoint);
}
if (currentGoal != null) {
currentGoal.onProviderChanged();
}
}
@Override
@ -262,6 +265,9 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
@Override
public void setPaused(boolean paused) {
this.paused = paused;
if (currentGoal != null) {
currentGoal.onProviderChanged();
}
}
/**
@ -275,6 +281,15 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
private class GuidedAIGoal implements Goal {
private GuidedPlan plan;
public void onProviderChanged() {
if (plan != null) {
reset();
if (npc.getNavigator().isNavigating()) {
npc.getNavigator().cancelNavigation();
}
}
}
@Override
public void reset() {
plan = null;