Autonomous Torch-Placing Miner

Build an automated armor stand miner in Minecraft that marches forward, swings its pickaxe to carve through stone tunnels, and places torches to light the way.

Java EditionMini-games & UtilitiesHard23 commandsTested on a real 26.2 & 26.3 server
An automated glowing armor stand miner tunnels through a cutaway stone structure at night. Download the GIF Video & GIF © www.9minecraft.net

Spawners & GeneratorsIndustrialTechnologyCyanYellowWhiteBuilding ToolAdventure MapMap MakingArmor standsSummoned mobsBlock building (fill/setblock/clone)Sounds21+ commands

Digging long mining tunnels by hand takes ages, so why not let an automated robot do the heavy lifting? This command creation summons an armored miner that marches forward on its own, swinging an enchanted diamond pickaxe to shatter solid stone and ore veins while leaving a trail of wall torches behind.

We build a cutaway mineshaft so you can watch the miner work from the side in the night. Glowing sparks, floating ore chunks, and realistic arm-swinging animations bring the little mechanical worker to life using vanilla command blocks.

1. Setup - type these once 9 commands

  1. /gamerule send_command_feedback false
  2. /scoreboard objectives add c9_tick dummy
  3. /scoreboard objectives add c9_step dummy
  4. /fill ~-9 ~ ~-3 ~9 ~4 ~1 minecraft:stone
  5. /fill ~-9 ~ ~-1 ~9 ~3 ~1 minecraft:air
  6. /fill ~-8 ~1 ~-2 ~8 ~2 ~-2 minecraft:diamond_ore replace minecraft:stone
  7. /fill ~-9 ~ ~-1 ~9 ~2 ~1 minecraft:stone
  8. /fill ~-9 ~ ~ ~-6 ~1 ~1 minecraft:air
  9. /summon minecraft:armor_stand ~-7 ~ ~0.5 {Tags:["c9_miner","c9_ent"],NoBasePlate:1b,ShowArms:1b,Rotation:[-90f,0f],Glowing:1b,CustomName:'{"text":"Auto-Miner","color":"aqua"}',CustomNameVisible:1b,equipment:{mainhand:{id:"minecraft:diamond_pickaxe",count:1,components:{"minecraft:enchantment_glint_override":true}},offhand:{id:"minecraft:torch",count:1},head:{id:"minecraft:golden_helmet",count:1},chest:{id:"minecraft:iron_chestplate",count:1},legs:{id:"minecraft:iron_leggings",count:1},feet:{id:"minecraft:leather_boots",count:1}},Pose:{RightArm:[-45f,0f,0f],LeftArm:[-20f,15f,0f]}}

2. Loop - one repeating command block each (Always Active) 14 commands

  1. /execute as @e[tag=c9_miner] run scoreboard players add @s c9_tick 1
  2. /execute as @e[tag=c9_miner,scores={c9_tick=1..5}] run data merge entity @s {Pose:{RightArm:[-110f,-10f,0f],LeftArm:[-35f,15f,0f],RightLeg:[25f,0f,0f],LeftLeg:[-25f,0f,0f]}}
  3. /execute as @e[tag=c9_miner,scores={c9_tick=6..10}] run data merge entity @s {Pose:{RightArm:[-25f,5f,0f],LeftArm:[-15f,15f,0f],RightLeg:[-25f,0f,0f],LeftLeg:[25f,0f,0f]}}
  4. /execute as @e[tag=c9_miner,scores={c9_tick=6}] at @s run particle minecraft:block{block_state:{Name:"minecraft:stone"}} ~0.8 ~1.1 ~ 0.3 0.4 0.3 0.15 25
  5. /execute as @e[tag=c9_miner,scores={c9_tick=6}] at @s run particle minecraft:crit ~0.8 ~1.2 ~ 0.2 0.2 0.2 0.3 12
  6. /execute as @e[tag=c9_miner,scores={c9_tick=6}] at @s run playsound minecraft:block.stone.hit block @a ~ ~ ~ 0.7 1.2
  7. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] at @s if block ~1 ~ ~ minecraft:stone run playsound minecraft:block.stone.break block @a ~ ~ ~ 1 0.9
  8. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] at @s if block ~1 ~ ~ minecraft:stone run particle minecraft:dust{color:[0.2,0.9,1.0],scale:1.4} ~1 ~1 ~-0.3 0.3 0.5 0.3 0.05 18
  9. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] at @s run fill ~1 ~ ~-0.4 ~1 ~1 ~0.4 minecraft:air destroy
  10. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] at @s run tp @s ~0.5 ~ ~
  11. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] run scoreboard players add @s c9_step 1
  12. /execute as @e[tag=c9_miner,scores={c9_tick=10..}] run scoreboard players set @s c9_tick 0
  13. /execute as @e[tag=c9_miner,scores={c9_step=6..}] at @s run setblock ~ ~1 ~-0.4 minecraft:wall_torch[facing=south]
  14. /execute as @e[tag=c9_miner,scores={c9_step=6..}] at @s run scoreboard players set @s c9_step 0

How it works

Frames from the test run

Autonomous Torch-Placing Miner - frame 1Autonomous Torch-Placing Miner - frame 2Autonomous Torch-Placing Miner - frame 3

Recorded on our own test server: 59 frames at about 9.8 fps. Our image check saw: A glowing armor stand miner holding a pickaxe digs sideways through a cutaway stone structure at night, dropping cobblestone items along its path, though its nametag shows raw JSON text and no wall torches are visible.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Create a flat area or stand where you want the demonstration mineshaft to appear.
  2. Run each of the setup commands in order to build the stone cutaway wall and summon the Auto-Miner at the entrance.
  3. Place a line of 14 command blocks connected together: set the first to Repeating, Unconditional, Always Active, and the remaining 13 to Chain, Unconditional, Always Active.
  4. Paste the 14 loop commands in order into the command block chain.
  5. Set the time to night (<code>/time set midnight</code>) so you can clearly see the wall torches lighting up the dark stone corridor as the miner advances.

Use it with real players

To deploy the miner wherever you are standing in survival or creative mode, skip the stone wall setup commands and summon the c9_miner armor stand at your own position using /execute at @p run summon minecraft:armor_stand ~ ~ ~ .... Because the movement and digging commands use local offsets along the X axis, face east when deploying it, or replace the relative offsets (~0.5 ~ ~ and ~1 ~ ~) with caret coordinates (^ ^ ^0.5 and ^ ^ ^1) so the miner digs in whatever direction you point it.

Remove it again 6 commands

  1. /kill @e[tag=c9_ent]
  2. /kill @e[type=minecraft:item,distance=..22]
  3. /fill ~-10 ~ ~-4 ~10 ~5 ~2 minecraft:air
  4. /scoreboard objectives remove c9_tick
  5. /scoreboard objectives remove c9_step
  6. /gamerule send_command_feedback true

FAQ

Why does the tunnel have an open side wall?

The setup builds a cutaway cross-section of a mineshaft with a diamond ore backing wall so you can watch the miner dig and place torches from the outside without solid stone blocking your view.

How do I change how often the miner places a torch?

Change the score check in the last two loop commands from c9_step=6.. to a higher number like c9_step=12.. (since each step is half a block, 12 steps equals 6 blocks between torches).

Commands used

/data/execute/fill/gamerule/particle/playsound/scoreboard/setblock/summon/tp

Similar creations

Join 9Minecraft News & Guides