Skip to content

Commit

Permalink
Add new navigator parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 6, 2013
1 parent 9c169b0 commit 75a0b62
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 75a0b62

Please sign in to comment.