Class TargetHelper
java.lang.Object
studio.magemonkey.fabled.api.target.TargetHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AABB
getAABB
(org.bukkit.entity.Entity entity) static List
<org.bukkit.entity.LivingEntity> getConeTargets
(org.bukkit.entity.LivingEntity source, double arc, double range, double rotation, boolean resetY) Gets the targets in a conestatic double
getHeight
(org.bukkit.entity.Entity entity) static org.bukkit.entity.LivingEntity
getLivingTarget
(org.bukkit.entity.LivingEntity source, double range) Gets the entity the player is looking atstatic org.bukkit.entity.LivingEntity
getLivingTarget
(org.bukkit.entity.LivingEntity source, double range, double tolerance) Gets the entity the player is looking atstatic List
<org.bukkit.entity.LivingEntity> getLivingTargets
(org.bukkit.entity.LivingEntity source, double range) Gets all entities the player is looking at within the rangestatic List
<org.bukkit.entity.LivingEntity> getLivingTargets
(org.bukkit.entity.LivingEntity source, double range, double tolerance) Gets all entities the player is looking at within the range using the given tolerance.static org.bukkit.Location
getOpenLocation
(org.bukkit.Location loc1, org.bukkit.Location loc2, boolean throughWall) Retrieves an open location along the line for teleporting or linear targetingstatic boolean
isBehind
(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target) Checks if the target is behind the entitystatic boolean
isBehind
(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target, double angle) Checks if the entity is behind the player restricted to the given anglestatic boolean
isInFront
(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target) Checks if the entity is in front of the entitystatic boolean
isInFront
(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target, double angle) Checks if the entity is in front of the entity restricted to the given anglestatic boolean
isObstructed
(org.bukkit.Location loc1, org.bukkit.Location loc2) Checks whether the line between the two points is obstructedstatic boolean
isSolid
(org.bukkit.Material mat)
-
Constructor Details
-
TargetHelper
public TargetHelper()
-
-
Method Details
-
getLivingTargets
public static List<org.bukkit.entity.LivingEntity> getLivingTargets(org.bukkit.entity.LivingEntity source, double range) Gets all entities the player is looking at within the range
Has a little bit of tolerance to make targeting easier
- Parameters:
source
- living entity to get the targets ofrange
- maximum range to check- Returns:
- all entities in the player's vision line
-
getLivingTargets
public static List<org.bukkit.entity.LivingEntity> getLivingTargets(org.bukkit.entity.LivingEntity source, double range, double tolerance) Gets all entities the player is looking at within the range using the given tolerance.
- Parameters:
source
- living entity to get the targets ofrange
- maximum range to checktolerance
- tolerance of the line calculation- Returns:
- all entities in the player's vision line
-
getLivingTarget
public static org.bukkit.entity.LivingEntity getLivingTarget(org.bukkit.entity.LivingEntity source, double range) Gets the entity the player is looking at
Has a little bit of tolerance to make targeting easier
- Parameters:
source
- living entity to get the target ofrange
- maximum range to check- Returns:
- entity player is looking at or null if not found
-
getLivingTarget
public static org.bukkit.entity.LivingEntity getLivingTarget(org.bukkit.entity.LivingEntity source, double range, double tolerance) Gets the entity the player is looking at
Has a little bit of tolerance to make targeting easier
- Parameters:
source
- living entity to get the target ofrange
- maximum range to checktolerance
- tolerance of the line calculation- Returns:
- entity player is looking at or null if not found
-
getConeTargets
public static List<org.bukkit.entity.LivingEntity> getConeTargets(org.bukkit.entity.LivingEntity source, double arc, double range, double rotation, boolean resetY) Gets the targets in a cone- Parameters:
source
- entity to get the targets forarc
- arc angle of the conerange
- range of the conerotation
- rotation of the coneresetY
- whether to reset the Y value of the target- Returns:
- list of targets
-
isInFront
public static boolean isInFront(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target) Checks if the entity is in front of the entity- Parameters:
entity
- entity to check fortarget
- target to check against- Returns:
- true if the target is in front of the entity
-
isInFront
public static boolean isInFront(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target, double angle) Checks if the entity is in front of the entity restricted to the given angle- Parameters:
entity
- entity to check fortarget
- target to check againstangle
- angle to restrict it to (0-360)- Returns:
- true if the target is in front of the entity
-
isBehind
public static boolean isBehind(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target) Checks if the target is behind the entity- Parameters:
entity
- entity to check fortarget
- target to check against- Returns:
- true if the target is behind the entity
-
isBehind
public static boolean isBehind(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target, double angle) Checks if the entity is behind the player restricted to the given angle- Parameters:
entity
- entity to check fortarget
- target to check againstangle
- angle to restrict it to (0-360)- Returns:
- true if the target is behind the entity
-
isObstructed
public static boolean isObstructed(org.bukkit.Location loc1, org.bukkit.Location loc2) Checks whether the line between the two points is obstructed- Parameters:
loc1
- first locationloc2
- second location- Returns:
- the location of obstruction or null if not obstructed
-
getOpenLocation
public static org.bukkit.Location getOpenLocation(org.bukkit.Location loc1, org.bukkit.Location loc2, boolean throughWall) Retrieves an open location along the line for teleporting or linear targeting- Parameters:
loc1
- start location of the pathloc2
- end location of the paththroughWall
- whether going through walls is allowed- Returns:
- the farthest open location along the path
-
isSolid
public static boolean isSolid(org.bukkit.Material mat) -
getAABB
-
getHeight
public static double getHeight(org.bukkit.entity.Entity entity)
-