Package org.mcmonkey.sentinel.targeting
Class SentinelTargetingHelper
java.lang.Object
org.mcmonkey.sentinel.SentinelHelperObject
org.mcmonkey.sentinel.targeting.SentinelTargetingHelper
Helper for targeting logic on an NPC.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe types of target lists. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe set of all current avoids for this NPC.The set of all current targets for this NPC.Fields inherited from class org.mcmonkey.sentinel.SentinelHelperObject
attackHelper, itemHelper, sentinel, targetingHelper, weaponHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a temporary avoid to this NPC.voidAdds a temporary target to this NPC (and squadmates if relevant).voidAdds a target directly to the NPC.booleancanSee(org.bukkit.entity.LivingEntity entity) Returns whether the NPC can see the target entity.org.bukkit.LocationFinds a spot this NPC should run to, to avoid threats.org.bukkit.entity.LivingEntityThis method searches for the nearest targetable entity with direct line-of-sight.org.bukkit.entity.LivingEntityFinds a nearby target that can be hit with a melee attack.static org.bukkit.LocationfindSpotForRunDirection(org.bukkit.Location start, double distance, org.bukkit.util.Vector direction) Returns a spot to run to if running in a certain direction.voidInforms the tracker that the given currentTarget UUID is an entity that cannot currently be seen.booleanisAvoided(org.bukkit.entity.LivingEntity entity) Returns whether an entity is marked to be avoided by this NPC's avoid lists.booleanisIgnored(org.bukkit.entity.LivingEntity entity) Returns whether an entity is ignored by this NPC's ignore lists.booleanisInvisible(org.bukkit.entity.LivingEntity entity) Returns whether an entity is invisible to this NPC.booleanisTargeted(org.bukkit.entity.LivingEntity entity) Returns whether an entity is targeted by this NPC's target lists.static booleanisUntargetable(org.bukkit.entity.Entity e) Returns whether an entity is not able to be targeted at all.voidProcess all current multi-targets.voidProcess avoid necessary avoidance.voidProcess a specific set of multi-targets.booleanremoveTarget(UUID id) Removes a temporary target from this NPC (and squadmates if relevant).booleanremoveTargetNoBounce(UUID target) Removes a target directly from the NPC.org.bukkit.LocationrunDirection(org.bukkit.Location center) Returns a direction to run in, avoiding threatening entities as best as possible.booleanshouldAvoid(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should avoid a specific entity.booleanshouldTarget(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should target a specific entity.voidUpdates the current avoids set for the NPC.voidUpdates the current targets set for the NPC.Methods inherited from class org.mcmonkey.sentinel.SentinelHelperObject
debug, getLivingEntity, getNPC, setTraitObject
-
Field Details
-
currentTargets
The set of all current targets for this NPC. -
currentAvoids
The set of all current avoids for this NPC.
-
-
Constructor Details
-
SentinelTargetingHelper
public SentinelTargetingHelper()
-
-
Method Details
-
canSee
public boolean canSee(org.bukkit.entity.LivingEntity entity) Returns whether the NPC can see the target entity. -
shouldTarget
public boolean shouldTarget(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should target a specific entity. -
shouldAvoid
public boolean shouldAvoid(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should avoid a specific entity. -
addAvoid
Adds a temporary avoid to this NPC. -
addTarget
Adds a temporary target to this NPC (and squadmates if relevant). -
removeTarget
Removes a temporary target from this NPC (and squadmates if relevant). Returns whether anything was removed. -
removeTargetNoBounce
Removes a target directly from the NPC. PreferremoveTargetover this in most cases. Returns whether anything was removed. -
informTargetHasNoLos
Informs the tracker that the given currentTarget UUID is an entity that cannot currently be seen. -
addTargetNoBounce
Adds a target directly to the NPC. PreferaddTargetover this in most cases. -
isInvisible
public boolean isInvisible(org.bukkit.entity.LivingEntity entity) Returns whether an entity is invisible to this NPC. -
isIgnored
public boolean isIgnored(org.bukkit.entity.LivingEntity entity) Returns whether an entity is ignored by this NPC's ignore lists. -
isTargeted
public boolean isTargeted(org.bukkit.entity.LivingEntity entity) Returns whether an entity is targeted by this NPC's target lists. Consider calling 'shouldTarget' instead. -
isAvoided
public boolean isAvoided(org.bukkit.entity.LivingEntity entity) Returns whether an entity is marked to be avoided by this NPC's avoid lists. -
processAvoidance
public void processAvoidance()Process avoid necessary avoidance. Builds a list of things we need to run away from, and then runs. -
findBestRunSpot
public org.bukkit.Location findBestRunSpot()Finds a spot this NPC should run to, to avoid threats. Returns null if there's nowhere to run. -
findSpotForRunDirection
public static org.bukkit.Location findSpotForRunDirection(org.bukkit.Location start, double distance, org.bukkit.util.Vector direction) Returns a spot to run to if running in a certain direction. Returns null if can't reasonably run that direction. -
runDirection
public org.bukkit.Location runDirection(org.bukkit.Location center) Returns a direction to run in, avoiding threatening entities as best as possible. Returns a location of the spot to run to. Returns null if nowhere to run. -
findBestTarget
public org.bukkit.entity.LivingEntity findBestTarget()This method searches for the nearest targetable entity with direct line-of-sight. Failing a direct line of sight, the nearest entity in range at all will be chosen. -
processAllMultiTargets
public void processAllMultiTargets()Process all current multi-targets. This is an internal call as part of the main logic loop. -
processMultiTargets
public void processMultiTargets(SentinelTargetList baseList, SentinelTargetingHelper.TargetListType type) Process a specific set of multi-targets. This is an internal call as part of the main logic loop. -
findQuickMeleeTarget
public org.bukkit.entity.LivingEntity findQuickMeleeTarget()Finds a nearby target that can be hit with a melee attack. -
updateAvoids
public void updateAvoids()Updates the current avoids set for the NPC. This is an internal call as part of the main logic loop. -
isUntargetable
public static boolean isUntargetable(org.bukkit.entity.Entity e) Returns whether an entity is not able to be targeted at all. -
updateTargets
public void updateTargets()Updates the current targets set for the NPC. This is an internal call as part of the main logic loop.
-