Class Composite

java.lang.Object
net.citizensnpcs.api.ai.tree.Composite
All Implemented Interfaces:
Behavior
Direct Known Subclasses:
ParallelComposite, Selector, Sequence

public abstract class Composite extends Object implements Behavior
The base class for composite Behaviors, which handle the transition between multiple sub-behaviors.
  • Field Details

    • parallelExecuting

      protected final List<Behavior> parallelExecuting
  • Constructor Details

  • Method Details

    • addBehavior

      public void addBehavior(Behavior behavior)
    • getBehaviors

      public List<Behavior> getBehaviors()
    • removeBehavior

      public void removeBehavior(Behavior behavior)
    • reset

      public void reset()
      Description copied from interface: Behavior
      Resets the behavior and any state it is holding.
      Specified by:
      reset in interface Behavior
    • shouldExecute

      public boolean shouldExecute()
      Description copied from interface: Behavior
      Returns whether the behavior is ready to run. Note this is called once when deciding whether to start execution of a leaf node. The actual execution status is determined by the return value of Behavior.run() which is repeatedly called by the executing node.
      Specified by:
      shouldExecute in interface Behavior
    • stopExecution

      protected void stopExecution(Behavior behavior)
    • tickParallel

      protected void tickParallel()