reasoning: Use 'execute as @a run' to iterate over all players, then give @s (the executor) a diamond. This ensures each player receives one diamond.

commands: execute as @a run give @s minecraft:diamond 1

error: While 'give @a' works in this case, using execute chains is the more flexible pattern for multi-step operations. Both are valid here, but the execute form is preferred for consistency.

difficulty: easy

extracted_from: execute_chain_training, Minecraft 1.21 command reference


reasoning: Use 'execute at @a' to run the particle command at each player's position. 'at' sets position context, so ~ ~1 ~ means 1 block above each player. Flame particles with small spread and low speed look good.

commands: execute at @a run particle minecraft:flame ~ ~1 ~ 0.5 0.5 0.5 0.02 20

commands: execute as @a run particle minecraft:flame ~ ~1 ~ 0.5 0.5 0.5 0.02 20

error: 'execute as' changes the executor but does NOT update position context. Relative coordinates (~ ~ ~) would resolve to the command source, not each player. Use 'execute at @a' for positional context.

difficulty: medium


reasoning: Need both 'as @a' and 'at @s' to summon lightning at each player's position. 'as @a' iterates over players, 'at @s' sets position to the current executor.

commands: execute as @a at @s run summon minecraft:lightning_bolt

commands: execute as @a run summon minecraft:lightning_bolt ~ ~ ~

error: 'execute as' without 'at @s' means ~ ~ ~ resolves to the command source position (console/server), not each player's position. Must chain 'at @s' after 'as @a'.


user_message: if I'm standing on diamond ore, announce it

reasoning: Use 'execute if block' to check the block below the player. Need 'at slingshooter08' first to set position context, then 'if block ~ ~-1 ~ minecraft:diamond_ore' to check the block one below feet.

commands: execute at slingshooter08 if block ~ ~-1 ~ minecraft:diamond_ore run say Found diamonds!

commands: execute if block ~ ~-1 ~ minecraft:diamond_ore run say Found diamonds!

error: Without 'at <player>', the relative coordinates resolve to the command source (0,0,0 or server origin), not the player's position.


reasoning: Target survival mode players with @a[gamemode=survival] selector. Use execute as to iterate, then effect give @s for each matched player. Speed level 1 for 60 seconds is a reasonable default.

commands: execute as @a[gamemode=survival] run effect give @s minecraft:speed 60 1

error: This gives speed to ALL players including creative/spectator. Use @a[gamemode=survival] selector to target only survival players.


reasoning: Use 'execute positioned' to set the execution position to specific coordinates, then summon. This is cleaner than using absolute coords in the summon command directly when building more complex chains.

commands: execute positioned 0 64 0 run summon minecraft:firework_rocket

error: While this also works for a simple case, the execute positioned form is preferred in chains where you need to reuse the position for multiple sub-commands.


reasoning: Use 'execute in minecraft:the_nether' to switch dimension context, then tp @s to move the player. The coordinates carry over so the player appears at the same x/z in the nether.

commands: execute in minecraft:the_nether run tp slingshooter08 ~ ~ ~

error: tp command does not accept a dimension argument. Must use 'execute in <dimension> run tp' to teleport across dimensions.


user_message: give all players on the red team a diamond sword

reasoning: Use @a[team=red] selector to target only players on the red team. Execute as iterates over each matching player.

commands: execute as @a[team=red] run give @s minecraft:diamond_sword 1

commands: give @a[team=Red] minecraft:diamond_sword 1

error: Team names are case-sensitive. 'Red' would not match team 'red'. Always use exact case.


user_message: store how many items I'm holding in a scoreboard

reasoning: Use 'execute store result score' to capture a command's return value into a scoreboard objective. 'data get entity' on SelectedItem.count returns the stack count of the held item.

commands: scoreboard objectives add held_count dummy

commands: execute store result score slingshooter08 held_count run data get entity slingshooter08 SelectedItem.count

commands: scoreboard players set slingshooter08 held_count 0

error: This just sets the score to 0. 'execute store result score' is needed to dynamically capture a value from a command's output into the scoreboard.

difficulty: hard


user_message: face where the nearest player is looking and shoot a fireball

reasoning: Use 'execute rotated as @p' to adopt the nearest player's rotation, then summon a fireball. The fireball will travel in the direction the nearest player is facing since ^ ^ ^2 uses local coordinates.

commands: execute rotated as @p positioned as @p run summon minecraft:fireball ^ ^ ^2

commands: summon minecraft:fireball ~ ~1 ~ {Motion:[0.0,0.0,1.0]}

error: This always shoots the fireball in the +Z direction regardless of where the player faces. Use 'execute rotated as @p' with local coordinates (^ ^ ^) to match the player's facing direction.


user_message: sudo give everyone in survival mode speed

reasoning: Natural language 'sudo' means execute as operator. Target survival players with gamemode selector. Speed 1 for 60s is a good default.

commands: execute as @a[gamemode=survival] run effect give @s minecraft:speed 60 1

commands: effect give @a[gamemode=survival] minecraft:speed 60 1

error: While this also works, using 'execute as @a[gamemode=survival] run effect give @s' is the preferred execute chain pattern for consistency and extensibility.

extracted_from: execute_chain_training, natural language mapping


reasoning: Natural language 'sudo spawn lightning on all players' maps to execute chain: as @a to iterate, at @s to get each player's position, then summon lightning_bolt.

commands: execute as @a at @s run summon minecraft:lightning_bolt

commands: execute as @a run summon minecraft:lightning_bolt

error: Missing 'at @s' -- without it, all lightning bolts spawn at the command source position, not at each player's location.


user_message: if anyone is below y 10, give them fire resistance

reasoning: Use 'execute as @a' to iterate over all players, 'at @s' to get their position, then 'if block ~ -64 ~ minecraft:' won't work. Instead use 'positioned' check or predicate. Simplest: use @a[y=..10] -- but y selector doesn't exist. Must use execute at and check y with 'if predicate' or use scoreboard. Simplest approach: use @a with position check via 'execute as @a at @s positioned ~ 0 ~ if entity @s[distance=..10]' -- this is complex. Better: just use @a[y=-64,dy=74] which selects players from y=-64 to y=10.

commands: execute as @a[y=-64,dy=74] run effect give @s minecraft:fire_resistance 300 0

commands: execute as @a[y=..10] run effect give @s minecraft:fire_resistance 300 0

error: The selector @a[y=..10] is invalid syntax. The y selector is an absolute coordinate origin, not a range. Use y=-64,dy=74 to select players from y=-64 spanning 74 blocks upward (to y=10).


user_message: if it's raining, give everyone water breathing

reasoning: Use 'execute if predicate' with weather check. In 1.21, the simplest approach is using 'execute if predicate' but that requires a datapack. Alternative: this is typically done with a repeating command block. For a single console command, we can just apply the effect -- the human decides when it's raining.

commands: effect give @a minecraft:water_breathing 600 0

commands: execute if weather rain run effect give @a minecraft:water_breathing 600 0

error: 'execute if weather' is not valid syntax. There is no weather sub-command for execute. Weather checks require predicates in a datapack or manual observation.


reasoning: Use 'execute in minecraft:the_end' to switch dimension context, then tp @a to teleport all players. Place them on the obsidian platform at 100 49 0 which is the standard end spawn.

commands: execute in minecraft:the_end run tp @a 100 49 0

error: Missing 'minecraft:' namespace prefix. The dimension ID must be 'minecraft:the_end', not 'the_end'.


user_message: check if there's a chest below me and announce it

reasoning: Use 'execute at' to set position, 'if block ~ ~-1 ~ minecraft:chest' to check, then 'run say' to announce. Need to check for both chest and trapped_chest.

commands: execute at slingshooter08 if block ~ ~-1 ~ minecraft:chest run say There is a chest below me!

commands: execute at slingshooter08 if block ~ ~-1 ~ chest run say There is a chest below me!

error: Missing 'minecraft:' namespace prefix on block ID. Must use 'minecraft:chest', not 'chest'.


reasoning: Use 'execute as @e[type=minecraft:zombie,limit=1,sort=nearest]' to run as the nearest zombie. Example: make it say something with 'run say Brains!'

commands: execute as @e[type=minecraft:zombie,limit=1,sort=nearest] at @s run say Brains!

commands: execute as @e[type=zombie,limit=1,sort=nearest] run say Brains!

error: Missing 'minecraft:' namespace prefix on entity type. Must be 'minecraft:zombie'. Also missing 'at @s' if any positional commands follow.


reasoning: Use 'execute at @a' to position at each player, then kill zombies within a radius using @e[type=minecraft:zombie,distance=..20]. The distance selector is relative to the execution position.

commands: execute at @a run kill @e[type=minecraft:zombie,distance=..20]

error: This kills ALL zombies in the world, not just ones near players. Use 'execute at @a' with distance selector to limit to nearby zombies.


user_message: unless there's a player within 10 blocks of 0 64 0, spawn a zombie there

reasoning: Use 'execute positioned 0 64 0 unless entity @a[distance=..10]' to check that no players are within 10 blocks of the target coordinates, then summon.

commands: execute positioned 0 64 0 unless entity @a[distance=..10] run summon minecraft:zombie 0 64 0

commands: execute unless entity @a[distance=..10] positioned 0 64 0 run summon minecraft:zombie 0 64 0

error: Order matters: 'positioned' must come before the distance check. The distance selector is relative to the current execution position, so 'positioned' must set the position first.


reasoning: Creepers can be forced to explode by setting their Fuse to 0 or igniting them. In 1.21, use 'data merge entity' to set ignited:1b and Fuse:0. Execute as each creeper to target them individually.

commands: execute as @e[type=minecraft:creeper] run data merge entity @s {ignited:1b,Fuse:0}

error: This kills creepers silently without explosion. To make them actually explode, set ignited:1b and Fuse:0 with data merge.


user_message: place a diamond block under every player

reasoning: Use 'execute at @a' to get each player's position, then setblock ~ ~-1 ~ to place a block one below their feet.

commands: execute at @a run setblock ~ ~-1 ~ minecraft:diamond_block

commands: execute as @a run setblock ~ ~-1 ~ minecraft:diamond_block

error: 'execute as' does not set position context. Must use 'execute at @a' so that ~ ~-1 ~ resolves to each player's position.


user_message: give night vision to everyone in the nether

reasoning: Use 'execute in minecraft:the_nether as @a' -- but this doesn't filter by dimension. Need 'execute as @a[nbt={Dimension:"minecraft:the_nether"}]' to select only players in the nether. Then give them night vision.

commands: execute as @a[nbt={Dimension:"minecraft:the_nether"}] run effect give @s minecraft:night_vision 600 0

commands: execute in minecraft:the_nether run effect give @a minecraft:night_vision 600 0

error: 'execute in' changes the dimension context for the command but does NOT filter players by dimension. @a still selects all players. Use NBT dimension selector: @a[nbt={Dimension:"minecraft:the_nether"}].


user_message: run a command as every player who is sneaking

reasoning: Use NBT predicate to check for sneaking state. In 1.21, the sneaking pose is stored in the player's Pose field. Use @a[nbt={Pose:{IsSneaking:true}}] or the predicate approach.

commands: execute as @a[predicate=minecraft:sneaking] run say I am sneaking!

commands: execute as @a[sneaking=true] run say I am sneaking!

error: 'sneaking=true' is not a valid selector argument. Sneaking state must be checked via NBT or a predicate.


user_message: store my health in a scoreboard objective

reasoning: Use 'execute store result score' to capture the result of 'data get entity' into a scoreboard. Health is a float, so 'store result' truncates to int. Scale by 1 to get whole hearts.

commands: scoreboard objectives add health_val dummy

commands: execute store result score slingshooter08 health_val run data get entity slingshooter08 Health 1

commands: execute store result score slingshooter08 health_val run attribute slingshooter08 minecraft:generic.max_health get

error: This stores max_health, not current health. Use 'data get entity <player> Health' to get current health value.


user_message: clear the area around every player of hostile mobs

reasoning: Use 'execute at @a' to position at each player, then kill hostile mobs within a radius. Use type selector for common hostiles. Multiple commands for each mob type, or use the team/tag approach. Simplest: kill entities of hostile types within distance.

commands: execute at @a run kill @e[type=minecraft:zombie,distance=..30]

commands: execute at @a run kill @e[type=minecraft:skeleton,distance=..30]

commands: execute at @a run kill @e[type=minecraft:creeper,distance=..30]

commands: execute at @a run kill @e[type=minecraft:spider,distance=..30]

commands: execute at @a run kill @e[type=minecraft:enderman,distance=..30]

commands: execute at @a run kill @e[type=minecraft:witch,distance=..30]

error: This kills ALL non-player entities in the entire world, including passive mobs, item frames, armor stands, etc. Should target specific hostile mob types within a radius of each player.


user_message: summon a firework at every player's location

reasoning: Use 'execute at @a' to iterate positions, then summon firework_rocket at each. The ~ ~ ~ resolves to each player's location.

commands: execute at @a run summon minecraft:firework_rocket ~ ~ ~

commands: execute as @a run summon minecraft:firework_rocket

error: 'execute as' without 'at @s' does not set position. All fireworks would spawn at the command source location. Use 'execute at @a' instead.


user_message: if there are more than 5 zombies nearby, warn me

reasoning: Count entities with 'execute store' into a scoreboard, then use 'execute if score' to check. First store the zombie count, then conditionally send message.

commands: scoreboard objectives add zombie_count dummy

commands: execute store result score slingshooter08 zombie_count if entity @e[type=minecraft:zombie,distance=..30]

commands: execute if score slingshooter08 zombie_count matches 6.. run tellraw slingshooter08 {"text":"Warning: Many zombies nearby!","color":"red"}

commands: execute if entity @e[type=minecraft:zombie,limit=6,distance=..30] run say Warning!

error: 'if entity' with limit=6 checks if at least 1 entity matches (after limiting to 6), not if there are more than 5. Need scoreboard to do numeric comparison.


user_message: sudo make it so every player on fire gets healed

reasoning: Select players who are on fire using NBT: @a[nbt={Fire:1s}] won't work reliably. Better approach: use the fire ticks check. In practice, check for fire with @a[nbt={Fire:1}] -- but Fire is a short. Use @a[predicate=...] or simpler approach: give fire_resistance to all.

commands: execute as @a[nbt={Fire:1s}] run effect give @s minecraft:instant_health 1 1

commands: execute as @a run effect give @s minecraft:instant_health 1 1

error: This heals ALL players, not just those on fire. Need NBT predicate to check fire state.


user_message: set everyone's spawn point to where they're standing

reasoning: Use 'execute as @a at @s' to iterate over players at their positions, then 'spawnpoint @s ~ ~ ~' sets each player's individual spawn to their current location.

commands: execute as @a at @s run spawnpoint @s ~ ~ ~

error: While 'spawnpoint @a' works, ~ ~ ~ would resolve to the command source position for all players. Must use 'execute as @a at @s' so each player's own position is used.


user_message: if a player is holding a diamond sword, give them strength

reasoning: Check the player's held item with NBT selector. SelectedItem stores the mainhand item. Use @a[nbt={SelectedItem:{id:"minecraft:diamond_sword"}}] to match players holding diamond swords.

commands: execute as @a[nbt={SelectedItem:{id:"minecraft:diamond_sword"}}] run effect give @s minecraft:strength 10 1

commands: execute as @a run effect give @s minecraft:strength 10 1

error: This gives strength to ALL players regardless of held item. Need NBT predicate on SelectedItem to check what the player is holding.


user_message: align the execution position to block coordinates and fill

reasoning: Use 'execute align xyz' to floor the position to the block grid. This is useful when you want to snap to block positions for fill commands to avoid off-by-one issues.

commands: execute at slingshooter08 align xyz run fill ~ ~ ~ ~4 ~4 ~4 minecraft:glass

commands: execute at slingshooter08 run fill ~ ~ ~ ~4 ~4 ~4 minecraft:glass

error: Without 'align xyz', the position may be fractional (e.g., -50.7, 65.3) which can cause unexpected block placement. 'align xyz' floors to integer coordinates.


reasoning: Use 'execute anchored eyes' to shift the position to eye level, then use local coordinates (^ ^ ^) with 'positioned' to step forward. This is the basis for raycast-like commands.

commands: execute as slingshooter08 at @s anchored eyes run particle minecraft:flame ^ ^ ^1 0 0 0 0 1

commands: execute as slingshooter08 at @s anchored eyes run particle minecraft:flame ^ ^ ^2 0 0 0 0 1

commands: execute as slingshooter08 at @s anchored eyes run particle minecraft:flame ^ ^ ^3 0 0 0 0 1

commands: execute as slingshooter08 at @s anchored eyes run particle minecraft:flame ^ ^ ^5 0 0 0 0 1

commands: execute as slingshooter08 at @s run particle minecraft:flame ^ ^ ^5 0 0 0 0 1

error: Without 'anchored eyes', the local coordinate origin is at the player's feet, not eye level. Raycasts should start from eye height.


reasoning: Use 'execute at @a' to set position at each player, then playsound. The sound category 'master' ensures everyone hears it. Volume 1, pitch 1 are defaults.

commands: execute at @a run playsound minecraft:entity.ender_dragon.growl master @a[distance=..1] ~ ~ ~ 1 1

commands: playsound minecraft:entity.ender_dragon.growl master @a

error: This plays the sound at the command source position for all players. Players far away won't hear it. Use 'execute at @a' to play at each player's position.


reasoning: Food level is stored in player NBT as foodLevel (int, max 20). Use 'execute as @a' to iterate and 'data modify' to set it. Alternatively, use effect saturation.

commands: effect give @a minecraft:saturation 1 255

commands: execute as @a run data modify entity @s foodLevel set value 20

error: Player data is read-only via 'data modify' for most fields in vanilla. Use 'effect give @a minecraft:saturation' instead for a practical food-fill solution.


user_message: for each player, summon their own pet wolf

reasoning: Use 'execute as @a at @s' to iterate over each player at their position. Summon a tamed wolf with the Owner set to each player. However, Owner UUID is needed. Simpler: summon wolf and it can be tamed manually. For auto-tame, we need the player UUID which we don't have directly.

commands: execute as @a at @s run summon minecraft:wolf ~ ~ ~ {Tame:1b,CollarColor:14}

error: This summons only ONE wolf at the command source. Use 'execute as @a at @s' to summon one wolf per player at each player's position.


user_message: turn off all the lights near me (remove torches)

reasoning: Use fill command with 'replace' mode to swap torches with air in a radius around the player. Need to handle both wall_torch and regular torch.

commands: execute at slingshooter08 run fill ~-10 ~-5 ~-10 ~10 ~5 ~10 minecraft:air replace minecraft:torch

commands: execute at slingshooter08 run fill ~-10 ~-5 ~-10 ~10 ~5 ~10 minecraft:air replace minecraft:wall_torch

commands: execute at slingshooter08 run fill ~-10 ~-5 ~-10 ~10 ~5 ~10 air replace torch

error: Missing 'minecraft:' namespace prefix on both block IDs. Must use 'minecraft:air' and 'minecraft:torch'.


reasoning: Use 'execute store' to capture the player's XP level into a scoreboard, then use 'execute if score matches' to check the threshold.

commands: scoreboard objectives add xp_check dummy

commands: execute store result score slingshooter08 xp_check run xp query slingshooter08 levels

commands: execute if score slingshooter08 xp_check matches 11.. run say I have more than 10 levels!

commands: execute if entity slingshooter08[level=10..] run say I have more than 10 levels!

error: 'level' is a valid selector argument but it's 'level=10..' which means 10 or more (inclusive). For 'more than 10', use level=11.. Also, using scoreboard store is the standard execute chain approach.


user_message: on every tick, damage players standing on magma

reasoning: This requires a repeating command block or datapack function on tick. As a single console command, we can do one check: 'execute as @a at @s if block ~ ~-1 ~ minecraft:magma_block run damage @s 1 minecraft:hot_floor'. For repeating, they'd need a command block.

commands: execute as @a at @s if block ~ ~-1 ~ minecraft:magma_block run damage @s 1 minecraft:hot_floor

commands: execute as @a if block ~ ~-1 ~ minecraft:magma_block run damage @s 1

error: Missing 'at @s' between 'as @a' and the block check. Without it, ~ ~-1 ~ checks the block at the command source, not under each player.


user_message: sudo give everyone glowing for 30 seconds

reasoning: The glowing effect makes players visible through walls with an outline. Simple effect give command with @a selector.

error: 'glow' is not a valid effect name. The correct effect ID is 'minecraft:glowing'.


reasoning: Use 'execute at slingshooter08 positioned ~ ~10 ~' to offset the position upward by 10 blocks. Then any subsequent command runs at that elevated position.

commands: execute at slingshooter08 positioned ~ ~10 ~ run summon minecraft:firework_rocket ~ ~ ~

commands: execute at slingshooter08 run summon minecraft:firework_rocket ~ ~10 ~

error: While this works for a single command, using 'positioned ~ ~10 ~' is the proper execute chain approach that allows multiple subsequent commands to use the offset position.


reasoning: Use 'execute at @e[type=minecraft:cow]' to iterate over every cow's position, then summon a chicken 1 block above each cow.

commands: execute at @e[type=minecraft:cow] run summon minecraft:chicken ~ ~1 ~

commands: execute as @e[type=minecraft:cow] run summon minecraft:chicken ~ ~1 ~

error: 'execute as' changes executor to the cow but doesn't set position. ~ ~1 ~ would resolve to command source. Use 'execute at' for position-based operations.


user_message: detect if a player walks into a specific area and announce it

reasoning: Use 'execute positioned' at the area center with 'if entity @a[distance=..5]' to detect players within 5 blocks of coordinates 100 65 100.

commands: execute positioned 100 65 100 if entity @a[distance=..5] run say A player entered the zone!

commands: execute if entity @a[x=95,y=60,z=95,dx=10,dy=10,dz=10] run say A player entered the zone!

error: While the volume selector (x,y,z,dx,dy,dz) works, using 'positioned' with 'distance' is simpler and more readable for spherical detection areas.


user_message: store the number of online players in a scoreboard

reasoning: Use 'execute store result score' with 'if entity @a' which returns the count of matching entities. Store in a fake player name like '#server' for global values.

commands: scoreboard objectives add server_info dummy

commands: execute store result score #server server_info if entity @a

commands: execute store result score #server server_info run list

error: 'list' command doesn't return a numeric value suitable for store. Use 'if entity @a' which returns the count of matching entities.


reasoning: Use slowness 127 to effectively freeze players in place. Alternatively, use tp loop but that requires command blocks. Slowness with high amplifier is the simplest single-command solution. Also add jump_boost 128 (negative) to prevent jumping.

commands: effect give @a minecraft:slowness 9999 127

commands: effect give @a minecraft:jump_boost 9999 128

error: This teleports all players to the command source once, not freezing them in place. For persistent freeze, use slowness 127 effect or a repeating tp in a command block.


user_message: execute as all entities except players and kill them

reasoning: Use @e[type=!minecraft:player] to select all non-player entities. This is a common cleanup command but is destructive -- removes items, mobs, vehicles, armor stands, everything.

commands: execute as @e[type=!minecraft:player] run kill @s

error: Missing 'minecraft:' namespace prefix. Must use 'minecraft:player'. Also, while 'kill @e[...]' works directly, the execute form shows the chain pattern.