select

public static List<T> select<T extends LivingEntity>(Player owner, Collection<T> nearby, double range, double assistDegrees, Predicate<T> eligible, ToIntFunction<T> priority, int limit)

Priorities sort first, then angular accuracy with a small distance preference.