Package me.tamkungz.nilkit.util
Class TargetFinder
java.lang.Object
me.tamkungz.nilkit.util.TargetFinder
TargetFinder — finds the entity currently under the crosshair.
Extracted from crosshair target detection logic used in example projects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectfindCrosshairTarget(Object feeder, double maxDistance, double minDot, SimpleRemap remap) Finds the player entity that the feeder is currently aiming at.static ObjectfindCrosshairTarget(Object feeder, SimpleRemap remap) Overload with default values (range = 6, minDot = 0.6).static booleanChecks whether the target entity is within range of the source entity.
-
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 blocksminDot- minimum dot product (0.0 = hemisphere, 1.0 = directly forward)remap- SimpleRemap instance- Returns:
- the targeted entity, or null if none found
-
findCrosshairTarget
Overload with default values (range = 6, minDot = 0.6). -
isInRange
Checks whether the target entity is within range of the source entity.
-