Class FpAnimationController

java.lang.Object
com.zigythebird.playeranimcore.animation.AnimationController
com.zigythebird.playeranimcore.animation.HumanoidAnimationController
com.zigythebird.playeranim.animation.PlayerAnimationController
com.github.razorplay01.fp_pal.firstperson.FpAnimationController
All Implemented Interfaces:
com.zigythebird.playeranimcore.animation.layered.IAnimation

public class FpAnimationController extends com.zigythebird.playeranim.animation.PlayerAnimationController
Separate animation controller for first-person animations. This is independent from the 3rd person animation stack to avoid priority conflicts.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.zigythebird.playeranimcore.animation.AnimationController

    com.zigythebird.playeranimcore.animation.AnimationController.AnimationSetter, com.zigythebird.playeranimcore.animation.AnimationController.AnimationStateHandler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.zigythebird.playeranimcore.api.firstPerson.FirstPersonConfiguration
    Both arms and both held items are shown by default in player-arm mode.
    static final Map<String, com.zigythebird.playeranimcore.math.Vec3f>
     

    Fields inherited from class com.zigythebird.playeranim.animation.PlayerAnimationController

    avatar

    Fields inherited from class com.zigythebird.playeranimcore.animation.HumanoidAnimationController

    BONE_POSITIONS, top_bones

    Fields inherited from class com.zigythebird.playeranimcore.animation.AnimationController

    activeBones, animationData, animationQueue, animationState, bonePositions, bones, currentAnimation, currentRawAnimation, customKeyframeHandler, EMPTY_KEYFRAME_LOCATION, EMPTY_SCALE_KEYFRAME_LOCATION, firstPersonConfiguration, firstPersonMode, handlingTriggeredAnimations, isLoopStarted, molangRuntime, needsAnimationReload, overrideEasingTypeFunction, particleKeyframeHandler, pivotBones, postAnimationSetupConsumer, soundKeyframeHandler, startAnimFrom, stateHandler, tick, triggeredAnimation

    Fields inherited from interface com.zigythebird.playeranimcore.animation.layered.IAnimation

    DEFAULT_FIRST_PERSON_CONFIG
  • Constructor Summary

    Constructors
    Constructor
    Description
    FpAnimationController(net.minecraft.world.entity.Avatar player, com.zigythebird.playeranimcore.animation.AnimationController.AnimationStateHandler animationStateHandler, com.zigythebird.playeranim.animation.AvatarAnimManager thirdPersonManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes a forced first-person mode, going back to the automatic one.
    void
     
    void
     
    com.zigythebird.playeranimcore.bones.PlayerAnimBone
    get3DTransformRaw(com.zigythebird.playeranimcore.bones.PlayerAnimBone bone)
    Outside first person this layer must leave every bone untouched (returning the input bone is the no-op); resetting it would overwrite the third-person animation.
     
     
    com.zigythebird.playeranimcore.math.Vec3f
     
    net.minecraft.resources.Identifier
     
    com.zigythebird.playeranimcore.api.firstPerson.FirstPersonConfiguration
     
    com.zigythebird.playeranimcore.api.firstPerson.FirstPersonMode
    Reports FirstPersonMode.NONE unless a mode was forced with /fp_anim mode.
    com.zigythebird.playeranim.animation.AvatarAnimManager
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    void
    Registers every bone of the first-person rig: fp_player_arms (root), the arms, the held items and fp_camera.
    void
     
    void
    setActive(boolean active)
     
    void
    setCurrentFpAnimation(net.minecraft.resources.Identifier id)
    Sets the FP animation to play.
    protected void
    Registers every bone the incoming first-person animation uses, so AzureLib extra bones (mag, slide, flash...) are kept instead of being ignored.

    Methods inherited from class com.zigythebird.playeranim.animation.PlayerAnimationController

    getAvatar, getBoneWorldPositionPoseStack, replaceAnimationWithFade, replaceAnimationWithFade, triggerAnimation, triggerAnimation

    Methods inherited from class com.zigythebird.playeranimcore.animation.HumanoidAnimationController

    process, registerTopPlayerAnimBone

    Methods inherited from class com.zigythebird.playeranimcore.animation.AnimationController

    addModifier, addModifierBefore, addModifierLast, applyCustomPivotPoints, forceAnimationReset, get3DTransform, getAnimationData, getAnimationSpeed, getAnimationState, getAnimationTicks, getAnimationTime, getBone, getCurrentAnimation, getCurrentAnimationInstance, getCurrentRawAnimation, getModifier, getModifierCount, getModifiers, getQueuedAnimations, getTriggeredAnimation, handleAnimation, handleCustomKeyframe, hasAnimationFinished, hasBeginTick, hasEndTick, isAnimationPlayerAnimatorFormat, isDisableAxisIfNotModified, isLoopStarted, isPlayingTriggeredAnimation, linkModifiers, pause, receiveTriggeredAnimations, registerPlayerAnimBone, registerPlayerAnimBone, removeAllModifiers, removeModifier, removeModifierIf, replaceAnimationWithFade, replaceAnimationWithFade, replaceAnimationWithFade, replaceAnimationWithFade, resetEventKeyFrames, setAnimation, setAnimation, setCustomInstructionKeyframeHandler, setFirstPersonConfiguration, setFirstPersonConfigurationHandler, setFirstPersonMode, setFirstPersonModeHandler, setOverrideEasingType, setOverrideEasingTypeFunction, setParticleKeyframeHandler, setPostAnimationSetupConsumer, setSoundKeyframeHandler, setupAnim, stop, stopTriggeredAnimation, tick, toString, triggerAnimation, triggerAnimation, triggerAnimation, triggerAnimation, unpause

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.zigythebird.playeranimcore.animation.layered.IAnimation

    canRemove, get3DTransform
  • Field Details

    • FP_BONE_POSITIONS

      public static final Map<String, com.zigythebird.playeranimcore.math.Vec3f> FP_BONE_POSITIONS
    • DEFAULT_FP_CONFIGURATION

      public static final com.zigythebird.playeranimcore.api.firstPerson.FirstPersonConfiguration DEFAULT_FP_CONFIGURATION
      Both arms and both held items are shown by default in player-arm mode.
  • Constructor Details

    • FpAnimationController

      public FpAnimationController(net.minecraft.world.entity.Avatar player, com.zigythebird.playeranimcore.animation.AnimationController.AnimationStateHandler animationStateHandler, com.zigythebird.playeranim.animation.AvatarAnimManager thirdPersonManager)
  • Method Details

    • getThirdPersonManager

      public com.zigythebird.playeranim.animation.AvatarAnimManager getThirdPersonManager()
    • getCurrentFpAnimation

      @Nullable public net.minecraft.resources.Identifier getCurrentFpAnimation()
    • setCurrentFpAnimation

      public void setCurrentFpAnimation(@Nullable net.minecraft.resources.Identifier id)
      Sets the FP animation to play. A non-null id also arms the next play request.
    • requestStop

      public void requestStop()
    • isPendingPlay

      public boolean isPendingPlay()
    • clearPendingPlay

      public void clearPendingPlay()
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface com.zigythebird.playeranimcore.animation.layered.IAnimation
      Overrides:
      isActive in class com.zigythebird.playeranimcore.animation.AnimationController
    • isRunning

      public boolean isRunning()
      Returns:
      whether this controller is playing an animation, independently of the current camera. Use this for the animation state handler; isActive() is the render-layer check and is false while the local player is in third person.
    • setActive

      public void setActive(boolean active)
    • isStopRequested

      public boolean isStopRequested()
    • clearStopRequest

      public void clearStopRequest()
    • clearFirstPersonModeOverride

      public void clearFirstPersonModeOverride()
      Removes a forced first-person mode, going back to the automatic one.
    • getFirstPersonMode

      @NotNull public com.zigythebird.playeranimcore.api.firstPerson.FirstPersonMode getFirstPersonMode()
      Reports FirstPersonMode.NONE unless a mode was forced with /fp_anim mode. NONE is the only mode that leaves PAL's own first-person machinery idle, which this addon needs because it renders first person itself.
      Specified by:
      getFirstPersonMode in interface com.zigythebird.playeranimcore.animation.layered.IAnimation
      Overrides:
      getFirstPersonMode in class com.zigythebird.playeranimcore.animation.AnimationController
    • isPlayerArmMode

      public boolean isPlayerArmMode()
      Returns:
      true while this controller is playing a first-person animation, i.e. while the vanilla arm has to be replaced by the fp_* rig.
    • getFirstPersonConfiguration

      @NotNull public com.zigythebird.playeranimcore.api.firstPerson.FirstPersonConfiguration getFirstPersonConfiguration()
      Specified by:
      getFirstPersonConfiguration in interface com.zigythebird.playeranimcore.animation.layered.IAnimation
      Overrides:
      getFirstPersonConfiguration in class com.zigythebird.playeranimcore.animation.AnimationController
    • get3DTransformRaw

      public com.zigythebird.playeranimcore.bones.PlayerAnimBone get3DTransformRaw(@NotNull com.zigythebird.playeranimcore.bones.PlayerAnimBone bone)
      Outside first person this layer must leave every bone untouched (returning the input bone is the no-op); resetting it would overwrite the third-person animation.
      Overrides:
      get3DTransformRaw in class com.zigythebird.playeranimcore.animation.HumanoidAnimationController
    • getBonePosition

      public com.zigythebird.playeranimcore.math.Vec3f getBonePosition(String name)
      Overrides:
      getBonePosition in class com.zigythebird.playeranimcore.animation.AnimationController
    • registerBones

      public void registerBones()
      Registers every bone of the first-person rig: fp_player_arms (root), the arms, the held items and fp_camera. PAL's loader normalizes rightArm/leftArm to right_arm/left_arm, so both spellings are registered. Any other bone is registered too (see setupNewAnimation()).
      Overrides:
      registerBones in class com.zigythebird.playeranimcore.animation.HumanoidAnimationController
    • setupNewAnimation

      protected void setupNewAnimation()
      Registers every bone the incoming first-person animation uses, so AzureLib extra bones (mag, slide, flash...) are kept instead of being ignored. They are available through getActiveBoneNames() / FpRenderState.getExtraBone(String), and their sound, particle and custom-instruction keyframes run through PAL's normal keyframe system.
      Overrides:
      setupNewAnimation in class com.zigythebird.playeranimcore.animation.AnimationController
    • getActiveBoneNames

      public Set<String> getActiveBoneNames()
      Returns:
      the names of every bone the currently playing first-person animation drives.
    • getAnimatedBoneNames

      public Set<String> getAnimatedBoneNames()
      Returns:
      only the bones that the current animation actually has keyframes for. FpRenderState.updateExtraBones(AvatarAnimManager, Set) uses this: a bone with no keyframes must keep its static geo pose instead of being overwritten with an identity transform.