Build a self-carving 9x9x9 Menger Sponge fractal in Minecraft using a laser core and automated clone commands that hollow out two full recursion levels.
Self-building StructuresTechnologyMysticGoldCyanWhiteLearningDecorationCinematicItem displaysArmor standsBlock building (fill/setblock/clone)Rotation math21+ commands
This command creation builds and carves a 9x9x9 Menger Sponge fractal above a dark pedestal. Starting as a solid block of gold and sea lanterns, an energy core scans through the structure, carving out the large 3x3x3 central tunnels before subdividing all 20 remaining sub-cubes into a level-2 fractal sponge.
By combining targeted /fill operations on a single corner sub-cube with /clone commands, the entire 729-block fractal generates automatically in a continuous loop without needing hundreds of individual block placements.
/scoreboard objectives add c9_t dummy/fill ~-6 ~ ~-6 ~6 ~ ~6 polished_deepslate/fill ~-5 ~ ~-5 ~5 ~ ~5 crying_obsidian/fill ~-6 ~1 ~-6 ~6 ~1 ~6 soul_lantern replace air/fill ~-5 ~1 ~-5 ~5 ~1 ~5 air/fill ~-4 ~2 ~-4 ~4 ~10 ~4 gold_block/fill ~-4 ~2 ~-4 ~4 ~10 ~4 sea_lantern outline/fill ~-3 ~3 ~-3 ~3 ~9 ~3 gold_block/summon armor_stand ~ ~6 ~ {Tags:["c9_ctrl"],Invisible:1b,NoGravity:1b,Marker:1b}/summon item_display ~ ~12.5 ~ {Tags:["c9_core"],item:{id:"minecraft:conduit"},Glowing:1b,glow_color_override:65535,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2.5f,2.5f,2.5f]}}/scoreboard players add @e[tag=c9_ctrl] c9_t 1/execute as @e[tag=c9_ctrl,scores={c9_t=160..}] run scoreboard players set @s c9_t 1/execute as @e[tag=c9_core] at @s run tp @s ~ ~ ~ ~8 ~/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 1..159 run particle end_rod ~ ~6 ~ 3.5 3.5 3.5 0.02 10 force/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 1..60 run particle dust{color:[0.0,1.0,1.0],scale:2.0} ~ ~6 ~ 3.2 3.2 3.2 0.1 40 force/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 5 run fill ~-1 ~5 ~-4 ~1 ~7 ~4 sea_lantern/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 12 run fill ~-1 ~5 ~-4 ~1 ~7 ~4 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 18 run fill ~-4 ~5 ~-1 ~4 ~7 ~1 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 24 run fill ~-1 ~2 ~-1 ~1 ~10 ~1 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 32 run fill ~-3 ~2 ~-4 ~-3 ~4 ~4 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 38 run fill ~-4 ~3 ~-4 ~-2 ~3 ~4 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 44 run fill ~-4 ~2 ~-3 ~-2 ~4 ~-3 air/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 45..48 run clone ~-4 ~2 ~-4 ~-2 ~4 ~-2 ~-1 ~2 ~-4/execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 50..120 run execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 50 run clone ~-4 ~2 ~-4 ~-2 ~4 ~4 ~2 ~2 ~-4loop #1 Advances the <code>c9_t</code> scoreboard timer on the controller entity every tick to sequence the fractal carving stages.loop #7 Carves the first level-1 tunnel along the Z axis by removing the central 3x3x9 column of blocks.loop #10 Begins level-2 fractal recursion by hollowing out the sub-tunnels along the West bottom edge of the sponge.loop #14 Clones the newly carved 3x3x9 fractal section across to the opposite side so the sub-cubes match symmetrically.


Recorded on our own test server: 58 frames at about 9.6 fps. Our image check saw: A large cube of sea lanterns and gold blocks sits on a dark obsidian pedestal while cyan and white particles carve out the central 3x3x3 tunnels and bottom sub-cubes.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To let a player trigger the fractal generation manually instead of running on a timer, remove the first two loop commands and have the player hold a custom item to increment c9_t using /execute if entity @a[nbt={SelectedItem:{id:"minecraft:amethyst_shard"}}] run scoreboard players add @e[tag=c9_ctrl] c9_t 1.
/kill @e[tag=c9_ctrl]/kill @e[tag=c9_core]/scoreboard objectives remove c9_t/fill ~-6 ~ ~-6 ~6 ~13 ~6 airYes, replace sea_lantern and gold_block in the setup commands with any solid blocks you prefer, such as copper and tinted glass.
A level-2 Menger sponge has dozens of small 1x1 tunnels. Carving one section and cloning it keeps the total command block count under 14.
▶Automated Spire ConstructorSelf-building StructuresMedium19 cmds
▶Colossal Algorithmic Maze BuilderSelf-building StructuresHard22 cmds
▶High-Speed Multi-Shape Maze GeneratorSelf-building StructuresHard24 cmds
▶Glitching Farlands Wall GeneratorSelf-building StructuresMedium24 cmds
▶Automated Orbital Dome BuilderSelf-building StructuresMedium23 cmds
▶Autonomous Colossus Orb BuilderSelf-building StructuresHard23 cmds