Interface IStateMachine<T extends IStateMachineTransition<S>,S extends IState>

Type Parameters:
T - the statemachine transition.
S - the State.
All Known Subinterfaces:
ITickRateStateMachine<S>
All Known Implementing Classes:
BasicStateMachine, TickRateStateMachine

public interface IStateMachine<T extends IStateMachineTransition<S>,S extends IState>
Statemachine interface, implement to add more statemachine types. Contains all needed functions for a basic statemachine
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTransition(T transition)
    Adds a transitions to the machine's transition table
    void
    addTransitionGroup(List<S> stateGroup, T transition)
    Add a transition to a group of states has higher priority than normal transitions
    boolean
    checkTransition(T transition)
    Checks the transitions condition
    net.minecraft.network.chat.Component
    Get the state transition history for display
    Return the current state of the Statemachine
    void
    removeTransition(T transition)
    Removes a transition from the machine's transition table
    void
    Reset the statemachine to the start
    void
    setHistoryEnabled(boolean enabled, int memorySize)
    Set whether the state history is tracked
    void
    Update the statemachine, checks current state and its transitions
    boolean
    transitionToNext(T transition)
    Change the state to the next
  • Method Details

    • addTransition

      void addTransition(T transition)
      Adds a transitions to the machine's transition table
      Parameters:
      transition - the transition to add.
    • addTransitionGroup

      void addTransitionGroup(List<S> stateGroup, T transition)
      Add a transition to a group of states has higher priority than normal transitions
      Parameters:
      transition - the transition to add
    • removeTransition

      void removeTransition(T transition)
      Removes a transition from the machine's transition table
      Parameters:
      transition - the transition to remove.
    • tick

      void tick()
      Update the statemachine, checks current state and its transitions
    • checkTransition

      boolean checkTransition(@NotNull T transition)
      Checks the transitions condition
      Parameters:
      transition - the transition to check.
      Returns:
      true if should run.
    • transitionToNext

      boolean transitionToNext(@NotNull T transition)
      Change the state to the next
      Parameters:
      transition - the transition providing the state change
      Returns:
      true if the transition provided a state to change to, false on null
    • getState

      S getState()
      Return the current state of the Statemachine
      Returns:
      the state.
    • reset

      void reset()
      Reset the statemachine to the start
    • setHistoryEnabled

      void setHistoryEnabled(boolean enabled, int memorySize)
      Set whether the state history is tracked
      Parameters:
      enabled -
      memorySize - amount of entries kept
    • getHistory

      net.minecraft.network.chat.Component getHistory()
      Get the state transition history for display
      Returns: