How to play or stop player animations - ZigyTheBird/ZigysPlayerAnimatorAPI GitHub Wiki

Using Java code

Simply use the PlayerAnimAPI class on server side or the PlayerAnimAPIClient for.. you get it.
If you are on the client side you can also trigger animations from the PlayerAnimations class, this will bypass fancy stuff like the mod logging the animations played for the Replaymod.
THE PlayerAnimAPI CLASS SENDS A PACKET TO THE CLIENT IN ORDER TO PLAY AN ANIMATION YOU DON'T HAVE TO DO IT YOURSELF.
The methods have Java docs so you should be fine on that front just choose the method that best fits what you want to do.

Using commands

The command for playing animations is /playPlayerAnimation and you can either just give it an animation ID or A LOT of paramaters which you will get introduced to further into this wiki page.
The command for stopping animations is /stopPlayerAnimation which takes the ID of the animation you want to cancel.

You can play the animation in the simplest way possible like this:
/playPlayerAnimation @p playeranimatorapi:wave
Or you can play it in a more advanced way like this:
/playPlayerAnimation @p playeranimatorapi:wave -1 -1 -1 false
Or you can give it all the parameters like this:
/playPlayerAnimation @p playeranimatorapi:wave -1 -1 -1 false "axq5j8jrytibv8jj" null

YOU CANNOT PLAY AN ANIMATION LIKE THIS ❌❌❌:
/playPlayerAnimation @p playeranimatorapi:wave -1

Default values

All paramaters except numerical ones can be set to null.
Set the numerical ones to -1 in order to use the default value.

The Paramaters

  • Player/Level: Pretty self explanatory.
  • animationID: Just a ResourceLocation that points to the animation.
  • fadeLength: How long it takes to transition to your animation (in ticks).
  • easeID: Here is a list of all different eases and their IDs. (Some might not apply to custom models)
  • priority: Self explanatory, 1000 by default. (Same value as Emotecraft)
  • firstPersonEnabled: Whether or not your animation gets played in first person. (Like Better Combat)
  • playerParts: A Java class for disabling modification of certain player parts. Can be represented by a string generated using this.
  • modifiers: You can find out more about those in their dedicated wiki page.
  • replaceTick: Only found in the Java client side methods if set to false the new animation playing will start where the previous one left off.