Class TickingTransition<S extends IState>

java.lang.Object
com.minecolonies.api.entity.ai.statemachine.basestatemachine.BasicTransition<S>
com.minecolonies.api.entity.ai.statemachine.tickratestatemachine.TickingTransition<S>
All Implemented Interfaces:
ITickingTransition<S>, IStateMachineTransition<S>
Direct Known Subclasses:
AITarget, TickingEvent

public class TickingTransition<S extends IState> extends BasicTransition<S> implements ITickingTransition<S>
Transition with tickrate logic, allows to define an intended tickrate at which this transition will be checked.
  • Constructor Details

    • TickingTransition

      public TickingTransition(@NotNull S state, @NotNull @NotNull IBooleanConditionSupplier condition, @NotNull @NotNull IStateSupplier<S> nextState, int tickRate)
      Create a new Transition with tickrate
      Parameters:
      state - State to apply the transition in
      condition - Condition checked before going to the next state
      nextState - The next state this transition leads into
      tickRate - The expected tickrate at which this transition should be checked.
    • TickingTransition

      public TickingTransition(@NotNull @NotNull IBooleanConditionSupplier condition, @NotNull @NotNull IStateSupplier<S> nextState, int tickRate)
      Create a new Transition with tickrate
      Parameters:
      condition - Condition checked before going to the next state
      nextState - The next state this transition leads into
      tickRate - The expected tickrate at which this transition should be checked.
  • Method Details

    • getTickRate

      public int getTickRate()
      Returns the intended tickRate of the AITarget
      Specified by:
      getTickRate in interface ITickingTransition<S extends IState>
      Returns:
      Tickrate
    • setTickRate

      public void setTickRate(int tickRate)
      Allow to dynamically change the tickrate
      Specified by:
      setTickRate in interface ITickingTransition<S extends IState>
      Parameters:
      tickRate - rate at which the AITarget should tick
    • countdownTicksToUpdate

      public int countdownTicksToUpdate(int reduction)
      Returns a preset offset to Ticks
      Specified by:
      countdownTicksToUpdate in interface ITickingTransition<S extends IState>
      Returns:
      random
    • setTicksToUpdate

      public void setTicksToUpdate(int ticksToUpdate)
      Description copied from interface: ITickingTransition
      Sets the ticks until next update
      Specified by:
      setTicksToUpdate in interface ITickingTransition<S extends IState>
      Parameters:
      ticksToUpdate -