Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/swing

Command

/swing

Makes entities play their arm swing animation.

Syntax

/swing [<targets> [(mainhand|offhand) [<animation> [<duration>]]]]

Arguments

ArgumentKind of valueWhat to type
<targets>Target selectorThe entities that swing. Defaults to the entity running the command. One or more entities.
<animation>Swing animationThe swing style: none, whack or stab. Defaults to whack.
<duration>TimeHow long the swing takes, at least 1 tick. Defaults to 6 ticks.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inSingleplayer 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.
ResultReports "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 argumentsWithout 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 onlyOnly 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".
Handmainhand or offhand chooses the arm. The default is mainhand.
AnimationThe animation is none, whack or stab. The default is whack.
DurationThe 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 onlyThe command only plays the animation. It does not attack or use an item.

Examples

/swing

Makes you swing your main hand.

/swing @e[type=minecraft:zombie]

Makes all Zombies swing their main hand.

/swing @s offhand

Makes you swing your off hand.

/swing @a mainhand stab

Makes all players play the stab animation with their main hand.

/swing @s mainhand whack 1s

Makes you play a slow swing that takes 1 second.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)