Class ModifierLayer<T extends IAnimation>
- Type Parameters:
T-
- All Implemented Interfaces:
IAnimation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModifier(@NotNull AbstractModifier modifier, int idx) voidaddModifierBefore(@NotNull AbstractModifier modifier) voidaddModifierLast(@NotNull AbstractModifier modifier) @NotNull Vec3fget3DTransform(@NotNull String modelName, @NotNull TransformType type, float tickDelta, @NotNull Vec3f value0) Get the transformed value to a model part, transform type.@NotNull FirstPersonConfigurationgetFirstPersonConfiguration(float tickDelta) Retrieves theFirstPersonConfigurationfor the current object, based on the providedtickDelta.@NotNull FirstPersonModegetFirstPersonMode(float tickDelta) Retrieves theFirstPersonModefor the current object, based on the providedtickDelta.booleanisActive()Is the animation currently active.protected voidvoidremoveModifier(int idx) voidreplaceAnimationWithFade(@NotNull AbstractFadeModifier fadeModifier, T newAnimation) Fade out from current animation into new animation.voidreplaceAnimationWithFade(@NotNull AbstractFadeModifier fadeModifier, T newAnimation, boolean fadeFromNothing) Fade out from current to a new animationvoidsetAnimation(T animation) voidsetupAnim(float tickDelta) Called before rendering a characterintsize()voidtick()Animation tick, on lag free client 20 [tick/sec] You can get the animations time from other places, but it will be invoked when the animation is ACTIVE
-
Constructor Details
-
ModifierLayer
-
ModifierLayer
public ModifierLayer()
-
-
Method Details
-
tick
public void tick()Description copied from interface:IAnimationAnimation tick, on lag free client 20 [tick/sec] You can get the animations time from other places, but it will be invoked when the animation is ACTIVE- Specified by:
tickin interfaceIAnimation
-
addModifier
-
addModifierBefore
-
addModifierLast
-
removeModifier
public void removeModifier(int idx) -
setAnimation
-
replaceAnimationWithFade
public void replaceAnimationWithFade(@NotNull @NotNull AbstractFadeModifier fadeModifier, @Nullable T newAnimation) Fade out from current animation into new animation. Does not fade if there is currently no active animation- Parameters:
fadeModifier- Fade modifier, useAbstractFadeModifier.standardFadeIn(int, Ease)for simple fade.newAnimation- New animation, can be null to fade into default state.
-
replaceAnimationWithFade
public void replaceAnimationWithFade(@NotNull @NotNull AbstractFadeModifier fadeModifier, @Nullable T newAnimation, boolean fadeFromNothing) Fade out from current to a new animation- Parameters:
fadeModifier- Fade modifier, useAbstractFadeModifier.standardFadeIn(int, Ease)for simple fade.newAnimation- New animation, can be null to fade into default state.fadeFromNothing- Do fade even if we go from nothing. (for KeyframeAnimation, it can be false by default)
-
size
public int size() -
linkModifiers
protected void linkModifiers() -
isActive
public boolean isActive()Description copied from interface:IAnimationIs the animation currently active. Tick will only be invoked when ACTIVE- Specified by:
isActivein interfaceIAnimation- Returns:
- active
-
get3DTransform
@NotNull public @NotNull Vec3f get3DTransform(@NotNull @NotNull String modelName, @NotNull @NotNull TransformType type, float tickDelta, @NotNull @NotNull Vec3f value0) Description copied from interface:IAnimationGet the transformed value to a model part, transform type.- Specified by:
get3DTransformin interfaceIAnimation- Parameters:
modelName- The questionable model parttype- Transform typetickDelta- Time since the last tick. 0-1value0- The value before the transform. For identity transform return with it.- Returns:
- The new transform value
-
setupAnim
public void setupAnim(float tickDelta) Description copied from interface:IAnimationCalled before rendering a character- Specified by:
setupAnimin interfaceIAnimation- Parameters:
tickDelta- Time since the last tick. 0-1
-
getFirstPersonMode
Retrieves theFirstPersonModefor the current object, based on the providedtickDelta.The method determines the appropriate
FirstPersonModeby following this logic: 1. It first attempts to retrieve the activeAbstractModifierby callinggetFirstPersonModifierOrDefault(). If a modifier is found, it delegates the call to the modifier'sAnimationContainer.getFirstPersonMode(float)method. 2. If no modifier is available or applicable, it checks if there is an active animation. If an animation exists, it delegates the call to the animation'sIAnimation.getFirstPersonMode(float)method. 3. If neither a modifier nor an animation is present, it falls back to the default implementation provided by theIAnimationinterface.- Specified by:
getFirstPersonModein interfaceIAnimation- Parameters:
tickDelta- A float value representing the partial tick time (used to interpolate between frames). This parameter is typically used in rendering calculations.- Returns:
- The
FirstPersonModedetermined by the current modifier, animation, or the default implementation.
-
getFirstPersonConfiguration
Retrieves theFirstPersonConfigurationfor the current object, based on the providedtickDelta.The method determines the appropriate
FirstPersonConfigurationby following this logic: 1. It first attempts to retrieve the activeAbstractModifierby callinggetFirstPersonModifierOrDefault(). If a modifier is found, it delegates the call to the modifier'sAnimationContainer.getFirstPersonConfiguration(float)method. 2. If no modifier is available or applicable, it checks if there is an active animation. If an animation exists, it delegates the call to the animation'sIAnimation.getFirstPersonConfiguration(float)method. 3. If neither a modifier nor an animation is present, it falls back to the default implementation provided by theIAnimationinterface.- Specified by:
getFirstPersonConfigurationin interfaceIAnimation- Parameters:
tickDelta- A float value representing the partial tick time (used to interpolate between frames). This parameter is typically used in rendering calculations.- Returns:
- The
FirstPersonConfigurationdetermined by the current modifier, animation, or the default implementation.
-