Class TargetHelper

java.lang.Object
studio.magemonkey.fabled.api.target.TargetHelper

public abstract class TargetHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 cone
    static 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 at
    static org.bukkit.entity.LivingEntity
    getLivingTarget(org.bukkit.entity.LivingEntity source, double range, double tolerance)
    Gets the entity the player is looking at
    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
    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.
    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
    static boolean
    isBehind(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target)
    Checks if the target is behind the entity
    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
    static boolean
    isInFront(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity target)
    Checks if the entity is in front of the entity
    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
    static boolean
    isObstructed(org.bukkit.Location loc1, org.bukkit.Location loc2)
    Checks whether the line between the two points is obstructed
    static boolean
    isSolid(org.bukkit.Material mat)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 of
      range - 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 of
      range - maximum range to check
      tolerance - 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 of
      range - 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 of
      range - maximum range to check
      tolerance - 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 for
      arc - arc angle of the cone
      range - range of the cone
      rotation - rotation of the cone
      resetY - 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 for
      target - 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 for
      target - target to check against
      angle - 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 for
      target - 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 for
      target - target to check against
      angle - 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 location
      loc2 - 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 path
      loc2 - end location of the path
      throughWall - whether going through walls is allowed
      Returns:
      the farthest open location along the path
    • isSolid

      public static boolean isSolid(org.bukkit.Material mat)
    • getAABB

      public static AABB getAABB(org.bukkit.entity.Entity entity)
    • getHeight

      public static double getHeight(org.bukkit.entity.Entity entity)