Procedural Labyrinth Builder

A glowing cyan builder drone weaves across a stone plinth, raising five-block stone brick walls and carving a fresh procedural labyrinth from scratch.

Java EditionComplex Contraptions & CinematicsHard22 commandsTested on a real 26.2 & 26.3 server
A glowing cyan drone hovers over a stone brick labyrinth with dark deepslate floors in Minecraft. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresTechnologyMedievalCyanBlackBuilding ToolMap MakingMini-gameBlock displaysSmooth animation (interpolation)Summoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

A glowing cyan block_display drone hovers above the centre of a grass grid and uses a randomized growing-tree algorithm to carve a brand-new 7x7 labyrinth every time you run it. As the drone glides from cell to cell, a beam of cyan dust particles drops down onto the ground while stone brick walls and dark deepslate floors erupt beneath it.

Instead of building from a pre-made template, the system tracks unvisited cells directly on the terrain and extrudes every newly placed wall upward to five blocks tall in real time. Once the final branch seals off, the north entrance opens automatically.

1. Setup - type these once 8 commands

  1. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 minecraft:smooth_stone
  2. /fill ~-14 ~-1 ~-14 ~14 ~-1 ~14 minecraft:grass_block
  3. /fill ~-2 ~0 ~-2 ~2 ~0 ~2 minecraft:stone_bricks
  4. /fill ~-1 ~0 ~-1 ~1 ~0 ~1 minecraft:air
  5. /fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 minecraft:polished_deepslate
  6. /setblock ~ ~-1 ~ minecraft:sea_lantern
  7. /execute align xz positioned ~0.5 ~ ~0.5 run summon minecraft:marker ~ ~ ~ {Tags:["c9_cell","c9_fresh"]}
  8. /execute align xz positioned ~0.5 ~ ~0.5 run summon minecraft:block_display ~ ~6 ~ {Tags:["c9_drone"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:sea_lantern"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.45f,-0.45f,-0.45f],scale:[0.9f,0.9f,0.9f]},teleport_duration:3}

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

  1. /execute as @e[tag=c9_cell] at @s unless block ~ ~-1 ~-4 minecraft:grass_block unless block ~4 ~-1 ~ minecraft:grass_block unless block ~ ~-1 ~4 minecraft:grass_block unless block ~-4 ~-1 ~ minecraft:grass_block run kill @s
  2. /execute at @e[tag=c9_drone,limit=1] run tag @e[tag=c9_cell,sort=nearest,limit=1] add c9_pick
  3. /execute as @e[tag=c9_pick,tag=c9_fresh] store result entity @s Rotation[0] float 90 run random value 0..3
  4. /tag @e[tag=c9_pick] remove c9_fresh
  5. /execute as @e[tag=c9_pick,limit=1] at @s if block ^ ^-1 ^4 minecraft:grass_block run tp @e[tag=c9_drone,limit=1] ^ ^6 ^4 ~ 0
  6. /execute as @e[tag=c9_pick,limit=1] at @s unless block ^ ^-1 ^4 minecraft:grass_block run tp @s ~ ~ ~ ~90 0
  7. /tag @e[tag=c9_pick] remove c9_pick
  8. /execute at @e[tag=c9_drone] if block ~ ~-7 ~ minecraft:grass_block run fill ~-2 ~-6 ~-2 ~2 ~-6 ~2 minecraft:stone_bricks
  9. /execute at @e[tag=c9_drone] if block ~ ~-7 ~ minecraft:grass_block run fill ^-1 ^-6 ^-2 ^1 ^-6 ^1 minecraft:air
  10. /execute at @e[tag=c9_drone] if block ~ ~-7 ~ minecraft:grass_block run summon minecraft:marker ~ ~-6 ~ {Tags:["c9_cell","c9_fresh"]}
  11. /execute at @e[tag=c9_drone] if block ~ ~-7 ~ minecraft:grass_block run fill ^-1 ^-7 ^-2 ^1 ^-7 ^1 minecraft:polished_deepslate
  12. /clone ~-14 ~0 ~-14 ~14 ~3 ~14 ~-14 ~1 ~-14 replace force
  13. /execute at @e[tag=c9_drone] if entity @e[tag=c9_cell] run particle minecraft:dust{color:[0.15,0.85,1.0],scale:1.6} ~ ~-3 ~ 0.35 2.4 0.35 0.01 16
  14. /execute unless entity @e[tag=c9_cell] run fill ~-1 ~0 ~-14 ~1 ~4 ~-14 minecraft:air

How it works

Frames from the test run

Procedural Labyrinth Builder - frame 1Procedural Labyrinth Builder - frame 2Procedural Labyrinth Builder - frame 3

Recorded on our own test server: 63 frames at about 8.9 fps. Our image check saw: All three identical frames show a finished stone brick labyrinth with deepslate floors and a glowing cyan block hovering above it, without active movement or particle beams.

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. Find a flat area at least 35x35 blocks wide with open sky above it.
  2. Stand in the exact centre of the platform on the first air block above the grass.
  3. Place 14 repeating command blocks set to Always Active and Unconditional, and paste each loop command into them in order from 1 to 14.
  4. Run the 8 setup commands once in chat (or via an impulse command block chain) from the centre spot.
  5. Watch the cyan drone carve the 7x7 stone labyrinth from the centre outward and open the north gate when finished.

Use it with real players

Because the maze opens its north gate at ~ ~ ~-14 as soon as generation finishes, players can walk straight into the labyrinth and race to reach the central sea_lantern core. To generate a brand-new layout at any time, run the four removal commands followed by the eight setup commands.

Remove it again 4 commands

  1. /kill @e[tag=c9_cell]
  2. /kill @e[tag=c9_drone]
  3. /fill ~-16 ~0 ~-16 ~16 ~5 ~16 minecraft:air
  4. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 minecraft:grass_block

FAQ

Does this generate the exact same maze every time?

No. Each newly carved cell rolls a fresh random cardinal facing with <code>/random value 0..3</code>, producing a different spanning-tree maze layout on every run.

Why does the maze use grass blocks and smooth stone under the floor?

Unvisited cells are marked by <code>grass_block</code> and turn into <code>polished_deepslate</code> once carved, while the outer <code>smooth_stone</code> border stops the algorithm from wandering off the grid.

Commands used

/clone/execute/fill/kill/particle/random/setblock/summon/tag/tp

Similar creations

Join 9Minecraft News & Guides