Respect plugin setting of useNewPathfinder better

This commit is contained in:
fullwall 2013-07-07 13:39:32 +08:00
parent 3c08d3c5b6
commit af40da3c0e
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class CitizensNavigator implements Navigator, Runnable {
private final NavigatorParameters defaultParams = new NavigatorParameters().baseSpeed(UNINITIALISED_SPEED) private final NavigatorParameters defaultParams = new NavigatorParameters().baseSpeed(UNINITIALISED_SPEED)
.range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat()) .range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat())
.stationaryTicks(Setting.DEFAULT_STATIONARY_TICKS.asInt()).stuckAction(TeleportStuckAction.INSTANCE) .stationaryTicks(Setting.DEFAULT_STATIONARY_TICKS.asInt()).stuckAction(TeleportStuckAction.INSTANCE)
.examiner(new MinecraftBlockExaminer()); .examiner(new MinecraftBlockExaminer()).useNewPathfinder(Setting.USE_NEW_PATHFINDER.asBoolean());
private PathStrategy executing; private PathStrategy executing;
private int lastX, lastY, lastZ; private int lastX, lastY, lastZ;
private NavigatorParameters localParams = defaultParams; private NavigatorParameters localParams = defaultParams;
@ -161,7 +161,7 @@ public class CitizensNavigator implements Navigator, Runnable {
} }
localParams = defaultParams.clone(); localParams = defaultParams.clone();
PathStrategy newStrategy; PathStrategy newStrategy;
if (Setting.USE_NEW_PATHFINDER.asBoolean() || localParams.useNewPathfinder()) { if (localParams.useNewPathfinder()) {
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);

View File

@ -40,8 +40,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
this.handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle(); this.handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
this.target = ((CraftEntity) target).getHandle(); this.target = ((CraftEntity) target).getHandle();
Navigation nav = NMS.getNavigation(this.handle); Navigation nav = NMS.getNavigation(this.handle);
this.targetNavigator = nav != null && !Setting.USE_NEW_PATHFINDER.asBoolean() && !params.useNewPathfinder() ? new NavigationFieldWrapper( this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(nav)
nav) : new AStarTargeter(); : new AStarTargeter();
this.aggro = aggro; this.aggro = aggro;
} }