Skip to content

Commit

Permalink
Add new parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Nov 22, 2020
1 parent d715cc0 commit 02f0812
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/main/java/net/citizensnpcs/api/ai/NavigatorParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class NavigatorParameters implements Cloneable {
private AttackStrategy attackStrategy;
private boolean avoidWater;
private float baseSpeed = 1F;
private List<NavigatorCallback> callbacks = Lists.newArrayListWithExpectedSize(3);
private List<NavigatorCallback> callbacks = Lists.newArrayList();
private boolean debug;
private AttackStrategy defaultStrategy;
private double distanceMargin = 2F;
Expand All @@ -29,9 +29,10 @@ public class NavigatorParameters implements Cloneable {
private Function<Entity, Location> mapper;
private double pathDistanceMargin = 1F;
private float range;
private List<Runnable> runCallbacks = Lists.newArrayListWithExpectedSize(3);
private List<Runnable> runCallbacks = Lists.newArrayList();
private float speedModifier = 1F;
private int stationaryTicks = -1;
private float straightLineTargetingDistance;
private StuckAction stuckAction;
private int updatePathRate;
private boolean useNewPathfinder;
Expand Down Expand Up @@ -450,6 +451,26 @@ public NavigatorParameters stationaryTicks(int ticks) {
return this;
}

/**
* @see #straightLineTargetingDistance(float)
* @return The distance
*/
public float straightLineTargetingDistance() {
return straightLineTargetingDistance;
}

/**
* Sets the distance (in blocks) at which the entity targeter will switch to simply following a straight line to the
* target instead of pathfinding.
*
* @param distance
* The distance (in blocks)
*/
public NavigatorParameters straightLineTargetingDistance(float distance) {
straightLineTargetingDistance = distance;
return this;
}

/**
* Gets the {@link StuckAction} of these parameters. This will be run when the navigation is stuck and must either
* be fixed up or cancelled.
Expand Down

0 comments on commit 02f0812

Please sign in to comment.