Self-Assembling Labyrinth Generator

Watch four glowing builders dart across a deepslate arena, constructing a 3D stone brick labyrinth around a spinning golden core in real time.

Java EditionComplex Contraptions & CinematicsHard24 commandsTested on a real 26.2 & 26.3 server
Four glowing builders construct a stone brick labyrinth around a floating fiery core. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresMedievalMysticBlackCyanGoldMini-gameAdventure MapBuilding ToolBlock displaysArmor standsBlock building (fill/setblock/clone)Rotation math21+ commands

The Self-Assembling Labyrinth Generator turns an empty deepslate arena into a full 3D maze right before your eyes. A spinning golden core floats in the middle while four cyan-glowing builders dart along a four-block grid, picking random directions every tick and slamming down stone brick walls, deepslate pillars, and glowing sea lantern caps.

Because each builder uses the game's random number generator every single tick, the layout is different every time you run the setup, giving you a fresh procedural dungeon arena in seconds.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_t dummy
  2. /scoreboard objectives add c9_rng dummy
  3. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 polished_deepslate
  4. /fill ~-16 ~ ~-16 ~16 ~3 ~16 deepslate_tiles hollow
  5. /fill ~-15 ~ ~-15 ~15 ~3 ~15 air
  6. /summon block_display ~ ~4.5 ~ {Tags:["c9_e","c9_core"],Glowing:1b,glow_color_override:16755200,block_state:{Name:"minecraft:gilded_blackstone"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[2.2f,2.2f,2.2f],translation:[-1.1f,-1.1f,-1.1f]}}
  7. /summon armor_stand ~-8 ~ ~-8 {Tags:["c9_e","c9_b"],Invisible:1b,NoGravity:1b,Glowing:1b,equipment:{head:{id:"minecraft:sea_lantern",count:1}}}
  8. /summon armor_stand ~8 ~ ~-8 {Tags:["c9_e","c9_b"],Invisible:1b,NoGravity:1b,Glowing:1b,equipment:{head:{id:"minecraft:sea_lantern",count:1}}}
  9. /summon armor_stand ~-8 ~ ~8 {Tags:["c9_e","c9_b"],Invisible:1b,NoGravity:1b,Glowing:1b,equipment:{head:{id:"minecraft:sea_lantern",count:1}}}
  10. /summon armor_stand ~8 ~ ~8 {Tags:["c9_e","c9_b"],Invisible:1b,NoGravity:1b,Glowing:1b,equipment:{head:{id:"minecraft:sea_lantern",count:1}}}

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

  1. /scoreboard players add #tick c9_t 1
  2. /execute as @e[tag=c9_core] at @s run tp @s ~ ~ ~ ~8 ~
  3. /execute at @e[tag=c9_core] run particle flame ~ ~0.5 ~ 1.2 1.2 1.2 0.05 8
  4. /execute as @e[tag=c9_b] at @s run particle soul_fire_flame ~ ~2.5 ~ 0.3 0.6 0.3 0.03 5
  5. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b] store result score @s c9_rng run random value 0..3
  6. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=0}] at @s if block ~4 ~-1 ~ polished_deepslate run fill ~ ~ ~ ~4 ~2 ~ stone_bricks replace air
  7. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=0}] at @s if block ~4 ~-1 ~ polished_deepslate run tp @s ~4 ~ ~
  8. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=1}] at @s if block ~-4 ~-1 ~ polished_deepslate run fill ~-4 ~ ~ ~ ~2 ~ stone_bricks replace air
  9. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=1}] at @s if block ~-4 ~-1 ~ polished_deepslate run tp @s ~-4 ~ ~
  10. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=2}] at @s if block ~ ~-1 ~4 polished_deepslate run fill ~ ~ ~ ~ ~2 ~4 stone_bricks replace air
  11. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=2}] at @s if block ~ ~-1 ~4 polished_deepslate run tp @s ~ ~ ~4
  12. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=3}] at @s if block ~ ~-1 ~-4 polished_deepslate run fill ~ ~ ~-4 ~ ~2 ~ stone_bricks replace air
  13. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b,scores={c9_rng=3}] at @s if block ~ ~-1 ~-4 polished_deepslate run tp @s ~ ~ ~-4
  14. /execute if score #tick c9_t matches ..160 as @e[tag=c9_b] at @s run setblock ~ ~3 ~ sea_lantern

How it works

Frames from the test run

Self-Assembling Labyrinth Generator - frame 1Self-Assembling Labyrinth Generator - frame 2Self-Assembling Labyrinth Generator - frame 3

Recorded on our own test server: 56 frames at about 9.2 fps. Our image check saw: A large stone brick and deepslate maze capped with sea lanterns, with a glowing golden core in the center and four outlined armor-stand builders moving along the grid.

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. Stand at the center of a flat open area at least 35x35 blocks wide.
  2. Run each of the 10 setup commands in chat or in impulse command blocks centered on the same reference coordinate.
  3. Place a repeating command block (Always Active) and 13 chain command blocks (Always Active, Unconditional) in a line.
  4. Paste the 14 loop commands in order into the repeating and chain command blocks.
  5. Watch the four glowing builders trace out the maze walls over 8 seconds until the timer hits 160 ticks.

Use it with real players

To let players carve out maze walls manually as they walk, replace @e[tag=c9_b] in the loop commands with @a[tag=maze_builder] and give yourself the tag with /tag @s add maze_builder.

Remove it again 5 commands

  1. /kill @e[tag=c9_e]
  2. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 grass_block
  3. /fill ~-16 ~ ~-16 ~16 ~6 ~16 air
  4. /scoreboard objectives remove c9_t
  5. /scoreboard objectives remove c9_rng

FAQ

How do I generate a brand new maze layout?

Run the cleanup commands to clear the arena, then run the setup commands again. Since it uses /random every tick, every layout is unique.

Can I make the maze walls denser or sparser?

Yes! Change the tick limit from ..160 in the loop commands to a lower number like ..80 for more open rooms, or ..240 for tighter corridors.

Commands used

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

Similar creations

Join 9Minecraft News & Guides