Class TargetSelector

java.lang.Object
net.minestom.server.entity.ai.TargetSelector
Direct Known Subclasses:
ClosestEntityTarget, LastEntityDamagerTarget

public abstract class TargetSelector extends Object
The target selector is called each time the entity receives an "attack" instruction without having a target.
  • Field Details

  • Constructor Details

    • TargetSelector

      public TargetSelector(@NotNull @NotNull EntityCreature entityCreature)
  • Method Details

    • findTarget

      @Nullable public abstract @Nullable Entity 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

      @NotNull public @NotNull EntityCreature getEntityCreature()
      Gets the entity linked to this target selector.
      Returns:
      the entity