Class BasicTransition<S extends IState>
java.lang.Object
com.minecolonies.api.entity.ai.statemachine.basestatemachine.BasicTransition<S>
- All Implemented Interfaces:
IStateMachineTransition<S>
- Direct Known Subclasses:
BasicEvent,TickingTransition
Basic Transition class for statemachines. Consists of a state the transition applies in, a statesupplier which determines its next state and a condition which has to be true to
transition into the next state.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBasicTransition(@NotNull IBooleanConditionSupplier condition, @NotNull IStateSupplier<S> nextState) Protected Constructor to allow subclasses without a stateBasicTransition(S state, @NotNull IBooleanConditionSupplier condition, @NotNull IStateSupplier<S> nextState) Creating a new transition from State A to B under condition C -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the condition of this transition appliesstatic StringgetMethodName(Serializable lambda) Reflection util for generating a name for the method refs used by transitions, until we properly name them allnet.minecraft.network.chat.ComponentgetName()Get the name of this transitionCalculate the next state to go intogetState()Returns the state to apply this transition in
-
Constructor Details
-
BasicTransition
public BasicTransition(@NotNull S state, @NotNull @NotNull IBooleanConditionSupplier condition, @NotNull @NotNull IStateSupplier<S> nextState) Creating a new transition from State A to B under condition C- Parameters:
state- State Acondition- Condition CnextState- State B
-
BasicTransition
protected BasicTransition(@NotNull @NotNull IBooleanConditionSupplier condition, @NotNull @NotNull IStateSupplier<S> nextState) Protected Constructor to allow subclasses without a state- Parameters:
condition- the condition.nextState- the next state to go to.
-
-
Method Details
-
getState
Returns the state to apply this transition in- Specified by:
getStatein interfaceIStateMachineTransition<S extends IState>- Returns:
- IAIState
-
getNextState
Calculate the next state to go into- Specified by:
getNextStatein interfaceIStateMachineTransition<S extends IState>- Returns:
- next AI state
-
checkCondition
public boolean checkCondition()Check if the condition of this transition applies- Specified by:
checkConditionin interfaceIStateMachineTransition<S extends IState>- Returns:
- true if ready to transition to next state
-
getName
public net.minecraft.network.chat.Component getName()Description copied from interface:IStateMachineTransitionGet the name of this transition- Specified by:
getNamein interfaceIStateMachineTransition<S extends IState>- Returns:
- name
-
getMethodName
Reflection util for generating a name for the method refs used by transitions, until we properly name them all -
withName
- Specified by:
withNamein interfaceIStateMachineTransition<S extends IState>
-