Self-Assembling Labyrinth

Modular deepslate corridors and glowing sea lantern nodes snap together and reconfigure themselves in real time to build a shifting maze.

Java EditionComplex Contraptions & CinematicsMedium22 commandsTested on a real 26.2 & 26.3 server
A Minecraft labyrinth self-assembles from stone bricks, deepslate pillars, and sea lanterns around a glowing nexus. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresDarkMysticMedievalCyanBluePurpleAdventure MapMini-gameMap MakingBlock displaysArmor standsSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

The Self-Assembling Labyrinth turns an empty platform into a living, shifting dungeon. A glowing central nexus sends out builder drones across a 31x31 grid, raising polished deepslate pillars, sea lantern beacons, and modular stone brick walls that rise out of the floor accompanied by soul flames and portal sparks.

By combining randomized entity selection with grid-snapped coordinates, the maze never builds the same layout twice. Sections of the labyrinth periodically collapse and rebuild in new directions, creating an endless self-constructing puzzle with zero data packs required.

1. Setup - type these once 8 commands

  1. /scoreboard objectives add c9_tick dummy
  2. /fill ~-15 ~-1 ~-15 ~15 ~-1 ~15 minecraft:polished_deepslate
  3. /fill ~-16 ~ ~-16 ~16 ~3 ~16 minecraft:deepslate_bricks outline
  4. /fill ~-15 ~ ~-15 ~15 ~3 ~15 minecraft:air
  5. /fill ~-1 ~ ~-1 ~1 ~3 ~1 minecraft:chiseled_deepslate
  6. /setblock ~ ~4 ~ minecraft:sea_lantern
  7. /summon minecraft:block_display ~-0.5 ~4.5 ~-0.5 {Tags:["c9_lab","c9_core"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:beacon"}}
  8. /summon minecraft:armor_stand ~ ~ ~ {Tags:["c9_lab","c9_spawner"],Invisible:1b,NoGravity:1b,Marker:1b}

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

  1. /scoreboard players add #c9_clock c9_tick 1
  2. /execute if score #c9_clock c9_tick matches 1..25 as @e[tag=c9_spawner] at @s run summon minecraft:armor_stand ~ ~ ~ {Tags:["c9_lab","c9_walker","c9_init"],Invisible:1b,NoGravity:1b,Marker:1b}
  3. /execute as @e[tag=c9_init,limit=1] at @s run spreadplayers ~ ~ 3 12 false @s
  4. /execute as @e[tag=c9_init] at @s align xz positioned ~0.5 ~ ~0.5 run tp @s ~ ~ ~
  5. /tag @e[tag=c9_init] remove c9_init
  6. /execute if score #c9_clock c9_tick matches 30.. run scoreboard players set #c9_clock c9_tick 26
  7. /scoreboard players add #c9_step c9_tick 1
  8. /execute if score #c9_step c9_tick matches 4.. run scoreboard players set #c9_step c9_tick 0
  9. /execute if score #c9_step c9_tick matches 1 as @e[tag=c9_walker,limit=6,sort=random] at @s run fill ~-1 ~ ~-1 ~1 ~2 ~1 minecraft:air replace minecraft:stone_bricks
  10. /execute if score #c9_step c9_tick matches 1 as @e[tag=c9_walker,limit=4,sort=random] at @s if block ~ ~-1 ~ minecraft:polished_deepslate run fill ~ ~ ~-2 ~ ~2 ~2 minecraft:stone_bricks keep
  11. /execute if score #c9_step c9_tick matches 2 as @e[tag=c9_walker,limit=4,sort=random] at @s if block ~ ~-1 ~ minecraft:polished_deepslate run fill ~-2 ~ ~ ~2 ~2 ~ minecraft:stone_bricks keep
  12. /execute if score #c9_step c9_tick matches 3 as @e[tag=c9_walker,limit=3,sort=random] at @s if block ~ ~-1 ~ minecraft:polished_deepslate run fill ~ ~ ~ ~ ~3 ~ minecraft:chiseled_deepslate
  13. /execute if score #c9_step c9_tick matches 3 as @e[tag=c9_walker,limit=3,sort=random] at @s if block ~ ~3 ~ minecraft:chiseled_deepslate run setblock ~ ~3 ~ minecraft:sea_lantern
  14. /execute if score #c9_step c9_tick matches 1..3 as @e[tag=c9_walker,limit=5,sort=random] at @s run particle minecraft:soul_fire_flame ~ ~2.5 ~ 0.4 0.8 0.4 0.03 8 force

How it works

Frames from the test run

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

Recorded on our own test server: 57 frames at about 9.5 fps. Our image check saw: A deepslate-walled platform with a glowing cyan central nexus where stone brick walls, deepslate pillars, and sea lanterns assemble amid blue soul flames and purple sparks.

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 middle of an open flat area with at least 18 blocks of clearance in every direction.
  2. Run each of the 8 setup commands in chat to create the scoreboard objective, the deepslate labyrinth floor, the outer border wall, and the central nexus.
  3. Place 14 repeating command blocks set to Always Active near the centre (or in a chain starting from one repeating block).
  4. Paste the 14 loop commands into the command blocks in order.
  5. Watch as the 25 builder nodes spread across the floor and begin raising and reconfiguring walls, corridors, and glowing pillars automatically.
  6. To reset or remove the maze at any time, run the cleanup commands listed below.

Use it with real players

To let a player guide the maze construction around themselves in real time, replace @e[tag=c9_spawner] in the second loop command with @a[nbt={SelectedItem:{id:"minecraft:recovery_compass"}}] and add a repeating command that removes old nodes after 5 seconds. Holding a Recovery Compass will then cause self-assembling maze walls to sprout around you as you walk.

Remove it again 4 commands

  1. /kill @e[tag=c9_lab]
  2. /fill ~-16 ~ ~-16 ~16 ~5 ~16 minecraft:air
  3. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 minecraft:grass_block
  4. /scoreboard objectives remove c9_tick

FAQ

Will the builder nodes ever create lag or multiply infinitely?

No. The clock counter caps the total number of builder nodes at exactly 25 entities on tick 25 and then loops between ticks 26 and 30 so no more entities are summoned.

How can I lock the labyrinth once it finishes generating a layout I like?

Simply run /kill @e[tag=c9_walker] in chat. All construction stops immediately while keeping the current walls, pillars, and lights intact.

Commands used

/execute/fill/particle/scoreboard/setblock/spreadplayers/summon/tag/tp

Similar creations

Join 9Minecraft News & Guides