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 class
AnimationStateMachine.ClipResolver
private static class
AnimationStateMachine.ParameterResolver
private static class
AnimationStateMachine.TransitionsAdapterFactory
-
Field Summary
Fields Modifier and Type Field Description private static com.google.gson.Gson
asmGson
private 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>>>
clipCache
private com.google.common.collect.ImmutableMap<java.lang.String,IClip>
clips
private IClip
currentState
private java.lang.String
currentStateName
private float
lastPollTime
private static org.apache.logging.log4j.Logger
LOGGER
private static AnimationStateMachine
missing
private com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue>
parameters
private boolean
shouldHandleSpecialEvents
private java.lang.String
startState
private com.google.common.collect.ImmutableList<java.lang.String>
states
private 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.String
currentState()
Get current state name.static AnimationStateMachine
getMissing()
(package private) void
initialize()
post-loading initialization hook.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.void
shouldHandleSpecialEvents(boolean value)
Set to true if the machine should handle special events that come from the clips (they start with '!').void
transition(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:IAnimationStateMachine
Sample 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:
apply
in interfaceIAnimationStateMachine
-
transition
public void transition(java.lang.String newState)
Description copied from interface:IAnimationStateMachine
Transition to a new state.- Specified by:
transition
in interfaceIAnimationStateMachine
-
currentState
public java.lang.String currentState()
Description copied from interface:IAnimationStateMachine
Get current state name.- Specified by:
currentState
in interfaceIAnimationStateMachine
-
shouldHandleSpecialEvents
public void shouldHandleSpecialEvents(boolean value)
Description copied from interface:IAnimationStateMachine
Set 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:
shouldHandleSpecialEvents
in 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()
-
-