Autonomous 3D Obstacle Navigator

Watch a live 3D Breadth-First Search algorithm expand cyan display cubes around floating purple glass barriers in Minecraft to find the shortest path.

Java EditionComplex Contraptions & CinematicsHard24 commandsTested on a real 26.2 & 26.3 server
A 3D grid of glowing cyan blocks expands around purple glass walls toward a golden beacon. Download the GIF Video & GIF © www.9minecraft.net

SimulationsTechnologyCyanPurpleGreenLearningMap MakingBlock displaysBlock building (fill/setblock/clone)21+ commands

This command creation builds a live 3D breadth-first search (BFS) visualizer inside Minecraft. Starting from a glowing emerald block on the left, cyan display cubes expand outward in six directions across a three-dimensional lattice, automatically navigating around and over floating purple glass walls to reach the beacon target on the right.

Once the search wave reaches the destination, a golden path tracer steps backward along the distance gradient, highlighting the optimal 3D route in glowing gold blocks and end rod particles before resetting for another cycle.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_sys dummy
  2. /scoreboard objectives add c9_dist dummy
  3. /scoreboard players set #tick c9_sys 0
  4. /fill ~-9 ~-1 ~-7 ~9 ~-1 ~7 minecraft:deepslate_tiles
  5. /fill ~-4 ~1 ~-1 ~-4 ~9 ~6 minecraft:purple_stained_glass
  6. /fill ~0 ~1 ~-6 ~0 ~9 ~0 minecraft:purple_stained_glass
  7. /fill ~4 ~1 ~-1 ~4 ~5 ~6 minecraft:purple_stained_glass
  8. /summon marker ~0 ~4 ~0 {Tags:["c9_center"]}
  9. /summon block_display ~-6 ~2 ~0 {Tags:["c9_node","c9_start","c9_front"],Glowing:1b,glow_color_override:5635925,block_state:{Name:"minecraft:emerald_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.35f,-0.35f,-0.35f],scale:[0.7f,0.7f,0.7f]}}
  10. /summon block_display ~6 ~6 ~0 {Tags:["c9_goal"],Glowing:1b,glow_color_override:16755200,block_state:{Name:"minecraft:beacon"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.45f,-0.45f,-0.45f],scale:[0.9f,0.9f,0.9f]}}

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

  1. /scoreboard players add #tick c9_sys 1
  2. /execute if score #tick c9_sys matches 95.. run scoreboard players set #tick c9_sys 1
  3. /execute if score #tick c9_sys matches 1 run kill @e[tag=c9_tmp]
  4. /execute if score #tick c9_sys matches 1 as @e[tag=c9_start] run tag @s add c9_front
  5. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~2 ~ ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  6. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~-2 ~ ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  7. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~2 ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  8. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~-2 ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  9. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~ ~2 if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  10. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~ ~-2 if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}
  11. /execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] run tag @s remove c9_front
  12. /execute as @e[tag=c9_new] at @s run particle electric_spark ~ ~ ~ 0.1 0.1 0.1 0.05 3
  13. /execute as @e[tag=c9_new] run tag @s add c9_front
  14. /execute as @e[tag=c9_new] run tag @s remove c9_new

How it works

Frames from the test run

Autonomous 3D Obstacle Navigator - frame 1Autonomous 3D Obstacle Navigator - frame 2Autonomous 3D Obstacle Navigator - frame 3

Recorded on our own test server: 50 frames at about 9.9 fps. Our image check saw: Glowing cyan cubes form a 3D grid expanding from a green-outlined block on the left, navigating around purple glass walls toward a glowing golden beacon on the right.

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. Create a flat area of at least 20x20 blocks and stand in the center.
  2. Run all 10 setup commands in chat or an impulse command block to build the deepslate floor, purple glass barriers, start emerald block, and goal beacon.
  3. Place 14 repeating command blocks (or 1 repeating followed by 13 chain command blocks) set to Always Active.
  4. Paste the 14 loop commands in order into the command blocks.
  5. Watch the 3D cyan search lattice automatically expand around the purple glass obstacles every few seconds.

Use it with real players

To let players place their own obstacles or move the goal, break or build blocks anywhere inside the 15x15x15 search volume around the center marker. Because the expansion commands check if block ~ ~ ~ air in real time, the 3D search wave will automatically navigate around any new walls or ceilings you build on the next cycle.

Remove it again 8 commands

  1. /kill @e[tag=c9_node]
  2. /kill @e[tag=c9_goal]
  3. /kill @e[tag=c9_center]
  4. /kill @e[tag=c9_tmp]
  5. /fill ~-9 ~-1 ~-7 ~9 ~9 ~7 minecraft:air
  6. /fill ~-9 ~-1 ~-7 ~9 ~-1 ~7 minecraft:grass_block
  7. /scoreboard objectives remove c9_sys
  8. /scoreboard objectives remove c9_dist

FAQ

Why does the grid expand in steps of 2 blocks instead of 1?

Using a 2-block lattice spacing keeps the total number of block_display entities around 110 for the entire 3D volume, ensuring smooth framerates while keeping the interior of the 3D grid easy to see.

Can I change the obstacles?

Yes! The nodes test for air blocks at each lattice point, so you can build your own mazes out of any block and watch the cyan search wave find a way around them.

Commands used

/execute/fill/kill/particle/scoreboard/summon/tag

Similar creations

Join 9Minecraft News & Guides