Class ClosestEntityTarget
java.lang.Object
net.minestom.server.entity.ai.TargetSelector
net.minestom.server.entity.ai.target.ClosestEntityTarget
Target the closest targetable entity (based on the target predicate)
-
Field Summary
Fields inherited from class TargetSelector
entityCreature -
Constructor Summary
ConstructorsConstructorDescriptionClosestEntityTarget(EntityCreature entityCreature, double range, Predicate<Entity> targetPredicate) ClosestEntityTarget(EntityCreature entityCreature, float range, Class<? extends LivingEntity>... entitiesTarget) Deprecated. -
Method Summary
Methods inherited from class TargetSelector
getEntityCreature
-
Constructor Details
-
ClosestEntityTarget
@SafeVarargs @Deprecated public ClosestEntityTarget(EntityCreature entityCreature, float range, Class<? extends LivingEntity>... entitiesTarget) Deprecated.- Parameters:
entityCreature- the entity (self)range- the maximum range the entity can target others withinentitiesTarget- the entities to target by class
-
ClosestEntityTarget
public ClosestEntityTarget(EntityCreature entityCreature, double range, Predicate<Entity> targetPredicate) - Parameters:
entityCreature- the entity (self)range- the maximum range the entity can target others withintargetPredicate- the predicate used to check if the other entity can be targeted
-
-
Method Details
-
findTarget
Description copied from class:TargetSelectorFinds the target.Returning null means that this target selector didn't find any entity, the next
TargetSelectorwill be called until the end of the list or an entity is found.- Specified by:
findTargetin classTargetSelector- Returns:
- the target, null if not any
-
ClosestEntityTarget(EntityCreature, double, Predicate)