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 Summary
ConstructorsConstructorDescriptionTickingTransition(@NotNull IBooleanConditionSupplier condition, @NotNull IStateSupplier<S> nextState, int tickRate) Create a new Transition with tickrateTickingTransition(S state, @NotNull IBooleanConditionSupplier condition, @NotNull IStateSupplier<S> nextState, int tickRate) Create a new Transition with tickrate -
Method Summary
Modifier and TypeMethodDescriptionintcountdownTicksToUpdate(int reduction) Returns a preset offset to TicksintReturns the intended tickRate of the AITargetvoidsetTickRate(int tickRate) Allow to dynamically change the tickratevoidsetTicksToUpdate(int ticksToUpdate) Sets the ticks until next updateMethods inherited from class com.minecolonies.api.entity.ai.statemachine.basestatemachine.BasicTransition
checkCondition, getMethodName, getName, getNextState, getState, withNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.entity.ai.statemachine.transitions.IStateMachineTransition
checkCondition, getName, getNextState, getState, withName
-
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 incondition- Condition checked before going to the next statenextState- The next state this transition leads intotickRate- 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 statenextState- The next state this transition leads intotickRate- 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:
getTickRatein interfaceITickingTransition<S extends IState>- Returns:
- Tickrate
-
setTickRate
public void setTickRate(int tickRate) Allow to dynamically change the tickrate- Specified by:
setTickRatein interfaceITickingTransition<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:
countdownTicksToUpdatein interfaceITickingTransition<S extends IState>- Returns:
- random
-
setTicksToUpdate
public void setTicksToUpdate(int ticksToUpdate) Description copied from interface:ITickingTransitionSets the ticks until next update- Specified by:
setTicksToUpdatein interfaceITickingTransition<S extends IState>- Parameters:
ticksToUpdate-
-