Class TargetFinder

java.lang.Object
me.tamkungz.nilkit.util.TargetFinder

public final class TargetFinder extends Object
TargetFinder — finds the entity currently under the crosshair. Extracted from crosshair target detection logic used in example projects.
  • Method Details

    • findCrosshairTarget

      public static Object findCrosshairTarget(Object feeder, double maxDistance, double minDot, SimpleRemap remap)
      Finds the player entity that the feeder is currently aiming at.
      Parameters:
      feeder - the source entity (viewer)
      maxDistance - maximum distance in blocks
      minDot - minimum dot product (0.0 = hemisphere, 1.0 = directly forward)
      remap - SimpleRemap instance
      Returns:
      the targeted entity, or null if none found
    • findCrosshairTarget

      public static Object findCrosshairTarget(Object feeder, SimpleRemap remap)
      Overload with default values (range = 6, minDot = 0.6).
    • isInRange

      public static boolean isInRange(Object from, Object to, double maxDistance)
      Checks whether the target entity is within range of the source entity.