Wiki 9Minecraft Wiki 9Minecraft

Animate an NPC Using Expression Language and State Transitions

Java EditionModGuides 4FAQ 10Related mods 60
DownloadVortex Scripting Core Mod

Get the files on 9Minecraft

Contents (4)
  1. Loading Your Model and Viewing Animations
  2. Setting Up Animation States
  3. Writing Trigger Expressions
  4. Server Synchronization

Loading Your Model and Viewing Animations

Import your 3D model (glTF, GLB, OBJ, or Bedrock geo.json) using the built-in model viewer. The viewer displays your character's node hierarchy, helping you understand which bones control which parts. Examine existing animations to see how they're structured.

Setting Up Animation States

In the animation editor, create states for different actions: idle, walk, attack, or custom emotes. Define transitions between states using expression language conditions. For example, transition from idle to walk when the player moves, or idle to attack when a target is nearby.

Writing Trigger Expressions

Use the expression language to bind animations to game events. Reference player position, NPC health, or custom variables to decide which animation plays. The editor provides code hints for available functions and properties.

Server Synchronization

Enable server sync to ensure all players see the same animations at the same time. Test animations in multiplayer to confirm they play consistently across clients.

More guides for this mod