-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Navigator.java
112 lines (95 loc) · 3.08 KB
/
Navigator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package net.citizensnpcs.api.ai;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import net.citizensnpcs.api.npc.NPC;
/**
* Represents the pathfinding AI of an {@link NPC}. The navigator can path towards a single target at a time.
*/
public interface Navigator {
/**
* Cancels any running navigation towards a target.
*/
void cancelNavigation();
/**
* Returns the {@link NavigatorParameters} local to this navigator. These parameters are copied to local target
* parameters when a new target is started.
*
* @see #getLocalParameters()
* @return The default parameters
*/
NavigatorParameters getDefaultParameters();
/**
* Returns the current {@link EntityTarget} of the navigator, if any. May return null.
*
* @return The current entity target
*/
EntityTarget getEntityTarget();
/**
* Returns the {@link NavigatorParameters} local to any current target execution. These are updated independently of
* the default parameters.
*
* @see #getDefaultParameters()
* @return The local parameters
*/
NavigatorParameters getLocalParameters();
/**
* @return The {@link NPC} attached to this navigator
*/
NPC getNPC();
/**
*
* @return The current {@link PathStrategy} or null if the navigator is not pathfinding
*/
PathStrategy getPathStrategy();
/**
* Returns the current {@link Location} being navigated towards - this is not necessarily permanent and may change,
* for example when pathing towards a moving {@link Entity}. May return null.
*
* @return The target location
*/
Location getTargetAsLocation();
/**
* @return The current {@link TargetType} of the navigator
*/
TargetType getTargetType();
/**
* @see #getTargetType()
* @return Whether the navigator is currently pathing towards a target.
*/
boolean isNavigating();
/**
* @return Whether the navigator is currently paused
*/
boolean isPaused();
/**
* Sets whether the navigator is paused and shouldn't process the path for now.
*
* @param paused
* Whether the navigator should be paused or not
*/
void setPaused(boolean paused);
/**
* Sets the current navigation to an entity target.
*
* @param target
* The {@link Entity} to path towards
* @param aggressive
* Whether to attack the target when close enough
*/
void setTarget(Entity target, boolean aggressive);
/**
* Sets the current navigation using a list of {@link Vector}s which will be followed in turn.
*
* @param path
* The path
*/
void setTarget(Iterable<Vector> path);
/**
* Sets the current navigation to a {@link Location} destination.
*
* @param target
* The destination
*/
void setTarget(Location target);
}