Class AnimationStateMachine
- java.lang.Object
-
- net.minecraftforge.common.model.animation.AnimationStateMachine
-
- All Implemented Interfaces:
IAnimationStateMachine
public final class AnimationStateMachine extends java.lang.Object implements IAnimationStateMachine
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAnimationStateMachine.ClipResolverprivate static classAnimationStateMachine.ParameterResolverprivate static classAnimationStateMachine.TransitionsAdapterFactory
-
Field Summary
Fields Modifier and Type Field Description private static com.google.gson.GsonasmGsonprivate static com.google.common.cache.LoadingCache<org.apache.commons.lang3.tuple.Triple<? extends IClip,java.lang.Float,java.lang.Float>,org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>>>clipCacheprivate com.google.common.collect.ImmutableMap<java.lang.String,IClip>clipsprivate IClipcurrentStateprivate java.lang.StringcurrentStateNameprivate floatlastPollTimeprivate static org.apache.logging.log4j.LoggerLOGGERprivate static AnimationStateMachinemissingprivate com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue>parametersprivate booleanshouldHandleSpecialEventsprivate java.lang.StringstartStateprivate com.google.common.collect.ImmutableList<java.lang.String>statesprivate com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String>transitions
-
Constructor Summary
Constructors Constructor Description AnimationStateMachine(com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters, com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips, com.google.common.collect.ImmutableList<java.lang.String> states, com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions, java.lang.String startState)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>>apply(float time)Sample the state and events at the current time.java.lang.StringcurrentState()Get current state name.static AnimationStateMachinegetMissing()(package private) voidinitialize()post-loading initialization hook.static IAnimationStateMachineload(IResourceManager manager, ResourceLocation location, com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> customParameters)Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.voidshouldHandleSpecialEvents(boolean value)Set to true if the machine should handle special events that come from the clips (they start with '!').voidtransition(java.lang.String newState)Transition to a new state.
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
parameters
private final com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters
-
clips
private final com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips
-
states
private final com.google.common.collect.ImmutableList<java.lang.String> states
-
transitions
private final com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions
-
startState
@SerializedName("start_state") private final java.lang.String startState
-
shouldHandleSpecialEvents
private transient boolean shouldHandleSpecialEvents
-
currentStateName
private transient java.lang.String currentStateName
-
currentState
private transient IClip currentState
-
lastPollTime
private transient float lastPollTime
-
clipCache
private static final com.google.common.cache.LoadingCache<org.apache.commons.lang3.tuple.Triple<? extends IClip,java.lang.Float,java.lang.Float>,org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>>> clipCache
-
missing
private static final AnimationStateMachine missing
-
asmGson
private static final com.google.gson.Gson asmGson
-
-
Constructor Detail
-
AnimationStateMachine
public AnimationStateMachine(com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters, com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips, com.google.common.collect.ImmutableList<java.lang.String> states, com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions, java.lang.String startState)
-
-
Method Detail
-
initialize
void initialize()
post-loading initialization hook.
-
apply
public org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>> apply(float time)
Description copied from interface:IAnimationStateMachineSample the state and events at the current time. Event iterable will contain all events that happened from the last invocation of this method, from most to least recent. Event offset is relative to the previous event, and for the first event it's relative to the current time.- Specified by:
applyin interfaceIAnimationStateMachine
-
transition
public void transition(java.lang.String newState)
Description copied from interface:IAnimationStateMachineTransition to a new state.- Specified by:
transitionin interfaceIAnimationStateMachine
-
currentState
public java.lang.String currentState()
Description copied from interface:IAnimationStateMachineGet current state name.- Specified by:
currentStatein interfaceIAnimationStateMachine
-
shouldHandleSpecialEvents
public void shouldHandleSpecialEvents(boolean value)
Description copied from interface:IAnimationStateMachineSet to true if the machine should handle special events that come from the clips (they start with '!'). Right now only implemented event is "!transition:". Default value is true. - Specified by:
shouldHandleSpecialEventsin interfaceIAnimationStateMachine
-
load
public static IAnimationStateMachine load(IResourceManager manager, ResourceLocation location, com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> customParameters)
Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.
-
getMissing
public static AnimationStateMachine getMissing()
-
-