Interface Goal
public interface Goal
One behaviour a mob may pursue, scheduled by its
Goals.
Several goals run at once as long as they do not need the same controls: a mob may stroll while it looks at a player. Each tick, a goal that can start takes the controls it needs from the running goals of lower priority; a running goal stops once it no longer should continue or loses one of its controls.
- Since:
- 0.1.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleancanStart()Returnstrueif the goal may start now.flags()Returns the controls of the mob this goal needs while it runs.default booleanReturnstrueif a goal of better priority may take a control from this goal while it runs.intpriority()Returns the priority of this goal; the lower the value, the more important the goal.booleanReturnstrueif the goal, once running, should keep running.default voidstart()Called when the goal starts running.default voidstop()Called when the goal stops running, because it ended or was preempted.default voidtick()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
-
flags
-
isInterruptible
default boolean isInterruptible()Returnstrueif a goal of better priority may take a control from this goal while it runs.- Returns:
trueif a goal of better priority may take a control from this goal while it runs- Since:
- 0.1.0
-
canStart
boolean canStart()Returnstrueif the goal may start now.- Returns:
trueif the goal may start now- Since:
- 0.1.0
-
shouldContinue
boolean shouldContinue()Returnstrueif the goal, once running, should keep running.- Returns:
trueif 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
-