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
Modifier and TypeClassDescriptionstatic enum
The types of target lists. -
Field Summary
Modifier 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a temporary avoid to this NPC.void
Adds a temporary target to this NPC (and squadmates if relevant).void
Adds a target directly to the NPC.boolean
canSee
(org.bukkit.entity.LivingEntity entity) Returns whether the NPC can see the target entity.org.bukkit.Location
Finds a spot this NPC should run to, to avoid threats.org.bukkit.entity.LivingEntity
This method searches for the nearest targetable entity with direct line-of-sight.org.bukkit.entity.LivingEntity
Finds a nearby target that can be hit with a melee attack.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.void
Informs the tracker that the given currentTarget UUID is an entity that cannot currently be seen.boolean
isAvoided
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is marked to be avoided by this NPC's avoid lists.boolean
isIgnored
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is ignored by this NPC's ignore lists.boolean
isInvisible
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is invisible to this NPC.boolean
isTargeted
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is targeted by this NPC's target lists.static boolean
isUntargetable
(org.bukkit.entity.Entity e) Returns whether an entity is not able to be targeted at all.void
Process all current multi-targets.void
Process avoid necessary avoidance.void
Process a specific set of multi-targets.boolean
removeTarget
(UUID id) Removes a temporary target from this NPC (and squadmates if relevant).boolean
removeTargetNoBounce
(UUID target) Removes a target directly from the NPC.org.bukkit.Location
runDirection
(org.bukkit.Location center) Returns a direction to run in, avoiding threatening entities as best as possible.boolean
shouldAvoid
(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should avoid a specific entity.boolean
shouldTarget
(org.bukkit.entity.LivingEntity entity) Returns whether the NPC should target a specific entity.void
Updates the current avoids set for the NPC.void
Updates 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. PreferremoveTarget
over 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. PreferaddTarget
over 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.
-