Interface Goal


public interface Goal
One behaviour a mob may pursue, scheduled by its Goals.

A single goal runs at a time. Each tick, a goal of better priority than the running one that can start preempts it; the running goal stops once it no longer should continue.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the goal may start now.
    int
    Returns the priority of this goal; the lower the value, the more important the goal.
    boolean
    Returns true if the goal, once running, should keep running.
    default void
    Called when the goal starts running.
    default void
    Called when the goal stops running, because it ended or was preempted.
    default void
    Called every tick while the goal runs.
  • Method Details

    • priority

      int priority()
      Returns the priority of this goal; the lower the value, the more important the goal.
      Returns:
      the priority of this goal; the lower the value, the more important the goal
      Since:
      0.1.0
    • canStart

      boolean canStart()
      Returns true if the goal may start now.
      Returns:
      true if the goal may start now
      Since:
      0.1.0
    • shouldContinue

      boolean shouldContinue()
      Returns true if the goal, once running, should keep running.
      Returns:
      true if the goal, once running, should keep running
      Since:
      0.1.0
    • start

      default void start()
      Called when the goal starts running.
      Since:
      0.1.0
    • stop

      default void stop()
      Called when the goal stops running, because it ended or was preempted.
      Since:
      0.1.0
    • tick

      default void tick()
      Called every tick while the goal runs.
      Since:
      0.1.0