Package net.minestom.server.entity.ai
Class TargetSelector
java.lang.Object
net.minestom.server.entity.ai.TargetSelector
- Direct Known Subclasses:
ClosestEntityTarget
,LastEntityDamagerTarget
public abstract class TargetSelector
extends java.lang.Object
The target selector is called each time the entity receives an "attack" instruction
without having a target.
-
Field Summary
Fields Modifier and Type Field Description protected EntityCreature
entityCreature
-
Constructor Summary
Constructors Constructor Description TargetSelector(EntityCreature entityCreature)
-
Method Summary
Modifier and Type Method Description abstract Entity
findTarget()
Finds the target.EntityCreature
getEntityCreature()
Gets the entity linked to this target selector.
-
Field Details
-
Constructor Details
-
Method Details
-
findTarget
Finds the target.Returning null means that this target selector didn't find any entity, the next
TargetSelector
will be called until the end of the list or an entity is found.- Returns:
- the target, null if not any
-
getEntityCreature
Gets the entity linked to this target selector.- Returns:
- the entity
-