Interface Goal<T extends Mob>

All Known Subinterfaces:
VanillaGoal<T>

@NullMarked public interface Goal<T extends Mob>
Represents an AI goal of an entity
  • Method Summary

    Modifier and Type
    Method
    Description
    A unique key that identifies this type of goal.
    Returns a list of all applicable flags for this goal.
    boolean
    Checks if this goal should be activated
    default boolean
    Checks if this goal should stay active, defaults to shouldActivate()
    default void
    Called when this goal gets activated
    default void
    Called when this goal gets stopped
    default void
    Called each tick the goal is activated
  • Method Details

    • shouldActivate

      boolean shouldActivate()
      Checks if this goal should be activated
      Returns:
      if this goal should be activated
    • shouldStayActive

      default boolean shouldStayActive()
      Checks if this goal should stay active, defaults to shouldActivate()
      Returns:
      if this goal should stay active
    • start

      default void start()
      Called when this goal gets activated
    • stop

      default void stop()
      Called when this goal gets stopped
    • tick

      default void tick()
      Called each tick the goal is activated
    • getKey

      GoalKey<T> getKey()
      A unique key that identifies this type of goal. Plugins should use their own namespace, not the minecraft namespace. Additionally, this key also specifies to what mobs this goal can be applied to
      Returns:
      the goal key
    • getTypes

      EnumSet<GoalType> getTypes()
      Returns a list of all applicable flags for this goal.

      This method is only called on construction.

      Returns:
      the subtypes.