Package net.citizensnpcs.npc.ai
Class MCTargetStrategy
java.lang.Object
net.citizensnpcs.npc.ai.MCTargetStrategy
- All Implemented Interfaces:
EntityTarget
,PathStrategy
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionMCTargetStrategy
(NPC npc, Entity target, boolean aggro, NavigatorParameters params) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the CancelReason returned byPathStrategy.getCancelReason()
and attempts to resume pathfinding.getPath()
boolean
void
stop()
Forcibly stops pathfinding.toString()
boolean
update()
Updates and runs the pathfinding strategy on its current NPC and destination.
-
Constructor Details
-
Method Details
-
clearCancelReason
public void clearCancelReason()Description copied from interface:PathStrategy
Clears the CancelReason returned byPathStrategy.getCancelReason()
and attempts to resume pathfinding.- Specified by:
clearCancelReason
in interfacePathStrategy
-
getCancelReason
- Specified by:
getCancelReason
in interfacePathStrategy
- Returns:
- The reason for the pathfinding to stop, or null if it is still continuing.
-
getCurrentDestination
- Specified by:
getCurrentDestination
in interfacePathStrategy
- Returns:
- Gets the current movement destination
-
getPath
- Specified by:
getPath
in interfacePathStrategy
- Returns:
- A copy of the current path, if any
-
getTarget
- Specified by:
getTarget
in interfaceEntityTarget
- Returns:
- The
Entity
being targeted.
-
getTargetAsLocation
- Specified by:
getTargetAsLocation
in interfacePathStrategy
- Returns:
- Gets the target destination location
-
getTargetType
- Specified by:
getTargetType
in interfacePathStrategy
- Returns:
- The
TargetType
of this strategy
-
isAggressive
public boolean isAggressive()- Specified by:
isAggressive
in interfaceEntityTarget
- Returns:
- Whether the entity target should be attacked once within range
-
stop
public void stop()Description copied from interface:PathStrategy
Forcibly stops pathfinding. Note that this method does not necessarily set the cancel reason.- Specified by:
stop
in interfacePathStrategy
-
toString
-
update
public boolean update()Description copied from interface:PathStrategy
Updates and runs the pathfinding strategy on its current NPC and destination.- Specified by:
update
in interfacePathStrategy
- Returns:
- Whether pathfinding has completed
-