Animations and sounds

Back to PackEngine

Clip fields

Field Type Default Meaning
idle_animation string none Clip that loops while the item is held.
use_animation string none Clip played on right-click.
equip_animation string none Clip played when the item is drawn.
unequip_animation string none Clip played when switching away.
use_returns_to_equip boolean false After the use clip, play the matching equip clip before going back to idle.

Each of these has a plural form that takes a list:

{
  "idle_animations": ["idle", "idle_2", "idle_3"],
  "use_animations": ["use", "use_2", "use_3"],
  "equip_animations": ["equip", "equip_2", "equip_3"],
  "unequip_animations": ["unequip", "unequip_2", "unequip_3"]
}

If both are set, the plural one is used. The singular field is the same as a list of one.

A name matches a clip with that exact name or one ending in it, so use matches animation.medkit.use.

Clips that change with charges

On an item with use_mode: "multiple", the idle, equip and unequip clips move on as charges are spent. The clips are shared out evenly, so six charges and three clips gives each clip two charges. Use clips follow use_order instead (see Charges). Items in other use modes always use the first clip.

Sounds

The sounds object plays one sound when a use, equip or unequip starts:

"sounds": {
  "use": "medkit_use",
  "equip": "medkit_equip",
  "unequip": "minecraft:item.armor.equip_leather"
}

The keys are use, equip, unequip, and the name of any extra animation. One sound covers every clip in that family and always plays at the start.

If different clips need different sounds, you want more than one sound, you need to set volume or pitch, or the sound should play partway through, use a timed sound event instead.

When sounds stop

A sound belongs to the animation that started it. Every sound a pack plays, from sounds or from a timed sound event, follows the player who started it and stops when its use, equip or unequip animation ends:

There’s no field for any of this. Make a sound as long or short as you like; it’s cut at the end of its clip.

Durations

Field Type Default Meaning
duration ticks read from clip, else 32 Length of the use timeline.
equip_duration ticks read from clip, else 0 Length of the equip clip.
unequip_duration ticks read from clip, else 20 How long the old item stays drawn while it unequips.

PackEngine reads each clip’s animation_length, and every clip in a family gets its own length. A duration you set by hand only replaces the first clip’s. Clips from another namespace can’t be read, so they use the fallback values.

equip_duration doesn’t stop the player using or switching. One click plays the whole use timeline; the button doesn’t need to be held.

Third-person animations

third_person_animation points at a normal Bedrock animation file whose bones are the player model parts: head, body, right_arm, left_arm, right_leg and left_leg.

"held_icon": "my_pack:textures/item/medkit_held.png",
"third_person_animation": "my_pack:animations/item/medkit.third_person.animation.json",
"follow_head": ["right_arm"]

Third-person clips pair with first-person clips by name. When the held item’s first-person clip changes (to animation.use, an extra animation’s clip, and so on), the third-person clip with the same name starts on that frame, after the first-person blend-in if there is one. Other players see the pose in step, because the triggers already reach every client tracking the player.

A clip with no pair leaves the vanilla pose alone. Each clip blends in and out over 3 ticks. loop works as in Blockbench: true repeats, hold_on_last_frame holds the last frame, and anything else ends at the clip length.

To play a body pose from code, see Playing a third-person pose.