Self-Building Procedural Maze

Six glowing builder cubes scatter across a deepslate slab, carve gilded rooms, and tunnel a fresh procedural quartz-road maze right before your eyes.

Java EditionComplex Contraptions & CinematicsHard24 commandsTested on a real 26.2 & 26.3 server
Glowing block builders carve quartz-paved maze corridors through a deepslate brick slab between gilded blackstone rooms. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresDarkMedievalBlackWhiteCyanMini-gameAdventure MapMap MakingBlock displaysSmooth animation (interpolation)Summoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

Watch a solid slab of deepslate bricks transform into a complete dungeon maze on its own. Six glowing block_display builders scatter randomly across the arena, hollow out 5x5 rooms floored with gilded blackstone, and then wander along orthogonal paths to carve connecting corridors paved with quartz bricks.

Using pure vanilla commands with /spreadplayers, /random, and smooth display-entity interpolation, every 11-second cycle generates a brand-new layout with cyan dust particles marking each tunnel as it opens.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9tick dummy
  2. /scoreboard objectives add c9dir dummy
  3. /scoreboard players set #t c9tick 0
  4. /kill @e[tag=c9_room]
  5. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:65535,teleport_duration:2,block_state:{Name:"minecraft:sea_lantern"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}
  6. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:16766720,teleport_duration:2,block_state:{Name:"minecraft:gold_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}
  7. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:65535,teleport_duration:2,block_state:{Name:"minecraft:sea_lantern"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}
  8. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:16766720,teleport_duration:2,block_state:{Name:"minecraft:gold_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}
  9. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:16729343,teleport_duration:2,block_state:{Name:"minecraft:amethyst_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}
  10. /summon minecraft:block_display ~ ~2 ~ {Tags:["c9_room"],Glowing:1b,glow_color_override:16729343,teleport_duration:2,block_state:{Name:"minecraft:amethyst_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.4f,0.2f,-0.4f],scale:[0.8f,0.8f,0.8f]}}

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

  1. /scoreboard players add #t c9tick 1
  2. /execute if score #t c9tick matches 221.. run scoreboard players set #t c9tick 1
  3. /execute if score #t c9tick matches 1 run fill ~-15 ~-1 ~-15 ~15 ~-1 ~15 minecraft:polished_deepslate
  4. /execute if score #t c9tick matches 1 run fill ~-15 ~ ~-15 ~15 ~1 ~15 minecraft:deepslate_bricks
  5. /execute if score #t c9tick matches 2 run spreadplayers ~ ~ 4 8 false @e[tag=c9_room]
  6. /execute if score #t c9tick matches 6 at @e[tag=c9_room] run fill ~-2 ~-2 ~-2 ~2 ~-1 ~2 minecraft:air
  7. /execute if score #t c9tick matches 7 at @e[tag=c9_room] run fill ~-2 ~-3 ~-2 ~2 ~-3 ~2 minecraft:gilded_blackstone
  8. /execute if score #t c9tick matches 12..190 as @e[tag=c9_room] store result score @s c9dir run random value 0..7
  9. /execute if score #t c9tick matches 12..190 as @e[tag=c9_room,scores={c9dir=0}] at @s run tp @s ~ ~ ~ ~90 0
  10. /execute if score #t c9tick matches 12..190 as @e[tag=c9_room,scores={c9dir=4..7}] at @s run tp @s ^ ^ ^1
  11. /execute if score #t c9tick matches 12..190 positioned ~ ~ ~ as @e[tag=c9_room,distance=13..] at @s run tp @s ^ ^ ^-1 ~180 0
  12. /execute if score #t c9tick matches 12..190 at @e[tag=c9_room] run fill ~ ~-2 ~ ~ ~-1 ~ minecraft:air
  13. /execute if score #t c9tick matches 12..190 at @e[tag=c9_room] if block ~ ~-3 ~ minecraft:polished_deepslate run setblock ~ ~-3 ~ minecraft:quartz_bricks
  14. /execute if score #t c9tick matches 12..190 at @e[tag=c9_room] run particle minecraft:dust{color:[0.1,0.9,1.0],scale:1.5} ~ ~-0.5 ~ 0.35 0.6 0.35 0.05 5 force

How it works

Frames from the test run

Self-Building Procedural Maze - frame 1Self-Building Procedural Maze - frame 2Self-Building Procedural Maze - frame 3

Recorded on our own test server: 66 frames at about 9.4 fps. Our image check saw: Glowing colored block display entities with cyan particles move orthogonally through a deepslate brick slab, carving quartz-brick corridors between gilded blackstone rooms.

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. Clear a flat 41x41 area of grass or stone and stand at the center block where you want the maze.
  2. Run the 10 setup commands in order from chat or an impulse command block chain to create the scoreboards and summon the 6 glowing builder cubes.
  3. Place 14 Repeating, Unconditional, Always Active command blocks underneath or beside the center (use execute positioned at your center coordinates if the blocks are offset).
  4. Paste each of the 14 loop commands into the repeating command blocks in order.
  5. Step back or fly up above the platform and watch the markers scatter, carve rooms, and tunnel a fresh maze every 11 seconds.

Use it with real players

To let players explore a finished maze without it resetting, remove the second loop command (scoreboard players set #t c9tick 1) and place a button on an impulse command block running /scoreboard players set #t c9tick 0 so players can generate a brand-new maze whenever they are ready.

Remove it again 5 commands

  1. /kill @e[tag=c9_room]
  2. /scoreboard objectives remove c9tick
  3. /scoreboard objectives remove c9dir
  4. /fill ~-15 ~-1 ~-15 ~15 ~-1 ~15 minecraft:grass_block
  5. /fill ~-15 ~ ~-15 ~15 ~3 ~15 minecraft:air

FAQ

Why do the builders carve from above instead of walking on the ground?

Hovering one block above the walls keeps the glowing cubes visible from an overhead view and prevents them from getting trapped inside their own 2-block-tall walls.

Can I change the maze size or add more builders?

Yes. Expand the two reset /fill commands and increase the distance=13.. boundary check for a larger maze, or run additional setup /summon commands tagged c9_room to add more builders.

Commands used

/execute/fill/kill/particle/random/scoreboard/setblock/spreadplayers/summon/tp

Similar creations

Join 9Minecraft News & Guides