EntitiesJava
/swing
Triggers the hand-swing animation on an entity for a chosen hand, with no gameplay effect — purely cosmetic, for cutscenes and custom NPC behavior. Added in 1.21.2.
Syntax
Parameters
- targetoptional
- entity selector
- Entities to animate (default self).
- handoptional
- literal
- mainhand or offhand (default mainhand).
Examples
Swing your main hand.
Make a villager swing its off hand.
Permission level
/swing requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.