
Command
/swing
Makes entities play their arm swing animation.
| /swing [<targets> [(mainhand|offhand) [<animation> [<duration>]]]] |
| Argument | Kind of value | What to type |
|---|---|---|
| <targets> | Target selector | The entities that swing. Defaults to the entity running the command. One or more entities. |
| <animation> | Swing animation | The swing style: none, whack or stab. Defaults to whack. |
| <duration> | Time | How long the swing takes, at least 1 tick. Defaults to 6 ticks. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Singleplayer with cheats enabled, multiplayer servers, command blocks and functions. Needs permission level 2 (gamemasters): operators, players in a world with cheats enabled, command blocks and functions. |
| Result | Reports "Made <name> swing an arm" for one entity or "Made N entities swing their arms" for several. The number /execute store saves is the number of entities that swung. |
| No arguments | Without arguments the entity running the command swings its main hand. This form needs an entity as the one running it, so command blocks and the console must name the targets. |
| Living entities only | Only living entities such as players and mobs can swing. Other targets are skipped, and if none of the targets is a living entity the command fails with "No living entities were found to swing". |
| Hand | mainhand or offhand chooses the arm. The default is mainhand. |
| Animation | The animation is none, whack or stab. The default is whack. |
| Duration | The duration is how long the swing takes. It is a number with a unit: t for ticks (default), s for seconds or d for in-game days, and must be at least 1 tick. The default is 6 ticks (0.3 seconds). |
| Animation only | The command only plays the animation. It does not attack or use an item. |
/swingMakes you swing your main hand.
/swing @e[type=minecraft:zombie]Makes all Zombies swing their main hand.
/swing @s offhandMakes you swing your off hand.
/swing @a mainhand stabMakes all players play the stab animation with their main hand.
/swing @s mainhand whack 1sMakes you play a slow swing that takes 1 second.

