From 75a0b62a75f1ab9a2732108246a8827a180a5196 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 6 Jul 2013 12:01:51 +0800 Subject: [PATCH] Add new navigator parameter --- .../api/ai/NavigatorParameters.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java b/src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java index 226241ff..c2fad34e 100644 --- a/src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java +++ b/src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java @@ -4,6 +4,7 @@ import net.citizensnpcs.api.ai.event.CancelReason; import net.citizensnpcs.api.ai.event.NavigatorCallback; +import net.citizensnpcs.api.astar.AStarMachine; import net.citizensnpcs.api.astar.pathfinder.BlockExaminer; import com.google.common.collect.Lists; @@ -19,6 +20,7 @@ public class NavigatorParameters implements Cloneable { private float speedModifier = 1F; private int stationaryTicks = -1; private StuckAction stuckAction; + private boolean useNewPathfinder; /** * Adds a {@link NavigatorCallback} that will be removed @@ -276,4 +278,31 @@ public NavigatorParameters stuckAction(StuckAction action) { stuckAction = action; return this; } + + /** + * @see #useNewPathfinder(boolean) + * @return Whether to use the new pathfinder + */ + public boolean useNewPathfinder() { + return useNewPathfinder; + } + + /** + * Sets whether or not to use an A* pathfinder defined in + * {@link AStarMachine} for pathfinding. + * + * If this is set to false, then the Minecraft pathfinder will be used, + * which may or may not be more consistent. + * + * Note that certain API features will not be possible if this is set to + * false - this includes {@link #examiner(BlockExaminer)} and + * {@link #distanceMargin(double)}. + * + * @param use + * Whether to use the A* pathfinder + */ + public NavigatorParameters useNewPathfinder(boolean use) { + useNewPathfinder = use; + return this; + } }