Self-Generating Giant Menger Sponge

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.

Java EditionComplex Contraptions & CinematicsExpert24 commandsTested on a real 26.2 & 26.3 server
Cyan particles carve tunnels through a giant Menger sponge made of sea lanterns and gold blocks. Download the GIF Video & GIF © www.9minecraft.net

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.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_t dummy
  2. /fill ~-6 ~ ~-6 ~6 ~ ~6 polished_deepslate
  3. /fill ~-5 ~ ~-5 ~5 ~ ~5 crying_obsidian
  4. /fill ~-6 ~1 ~-6 ~6 ~1 ~6 soul_lantern replace air
  5. /fill ~-5 ~1 ~-5 ~5 ~1 ~5 air
  6. /fill ~-4 ~2 ~-4 ~4 ~10 ~4 gold_block
  7. /fill ~-4 ~2 ~-4 ~4 ~10 ~4 sea_lantern outline
  8. /fill ~-3 ~3 ~-3 ~3 ~9 ~3 gold_block
  9. /summon armor_stand ~ ~6 ~ {Tags:["c9_ctrl"],Invisible:1b,NoGravity:1b,Marker:1b}
  10. /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]}}

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

  1. /scoreboard players add @e[tag=c9_ctrl] c9_t 1
  2. /execute as @e[tag=c9_ctrl,scores={c9_t=160..}] run scoreboard players set @s c9_t 1
  3. /execute as @e[tag=c9_core] at @s run tp @s ~ ~ ~ ~8 ~
  4. /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
  5. /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
  6. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 5 run fill ~-1 ~5 ~-4 ~1 ~7 ~4 sea_lantern
  7. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 12 run fill ~-1 ~5 ~-4 ~1 ~7 ~4 air
  8. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 18 run fill ~-4 ~5 ~-1 ~4 ~7 ~1 air
  9. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 24 run fill ~-1 ~2 ~-1 ~1 ~10 ~1 air
  10. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 32 run fill ~-3 ~2 ~-4 ~-3 ~4 ~4 air
  11. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 38 run fill ~-4 ~3 ~-4 ~-2 ~3 ~4 air
  12. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 44 run fill ~-4 ~2 ~-3 ~-2 ~4 ~-3 air
  13. /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
  14. /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 ~-4

How it works

Frames from the test run

Self-Generating Giant Menger Sponge - frame 1Self-Generating Giant Menger Sponge - frame 2Self-Generating Giant Menger Sponge - frame 3

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.

Build it in your world

  1. Give yourself a command block with /give @s command_block and place yourself at the center of an open flat area.
  2. Run each of the 10 setup commands in chat one by one to build the pedestal, the initial 9x9x9 cube, and the floating conduit core.
  3. Place a line of 14 Repeating Command Blocks set to Always Active nearby.
  4. Paste one loop command into each repeating command block in order.
  5. Watch the energy core scan and hollow out the level-1 and level-2 Menger sponge tunnels.

Use it with real players

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.

Remove it again 4 commands

  1. /kill @e[tag=c9_ctrl]
  2. /kill @e[tag=c9_core]
  3. /scoreboard objectives remove c9_t
  4. /fill ~-6 ~ ~-6 ~6 ~13 ~6 air

FAQ

Can I change the blocks used for the Menger Sponge?

Yes, replace sea_lantern and gold_block in the setup commands with any solid blocks you prefer, such as copper and tinted glass.

Why does the command use /clone instead of filling every tunnel?

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.

Commands used

/clone/execute/fill/particle/scoreboard/summon/tp

Similar creations

Join 9Minecraft News & Guides