mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
Respect plugin setting of useNewPathfinder better
This commit is contained in:
parent
3c08d3c5b6
commit
af40da3c0e
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user