Self-Driving Block Display Traffic

Build an autonomous miniature traffic intersection in vanilla Minecraft using block displays that navigate roads, turn corners, and stop at red lights.

Java EditionHolograms & Display EntitiesHard24 commandsTested on a real 26.2 & 26.3 server
Glowing miniature vehicles drive through a small Minecraft intersection controlled by a red and green traffic signal. Download the GIF Video & GIF © www.9minecraft.net

VehiclesTechnologyBlackRedGreenDecorationMap MakingLearningBlock displaysSmooth animation (interpolation)Summoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

This command creation turns a flat patch of ground into a miniature self-driving traffic intersection. Glowing block display vehicles follow an asphalt loop by checking the blocks underneath them, smoothly steering around corners and leaving exhaust particle trails behind.

At the center of the crossroad, a suspended traffic signal cycles between green and red. When the light turns red, an invisible barrier drops into the intersection, causing incoming cars to brake and queue up behind one another without colliding.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_t dummy
  2. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:polished_andesite
  3. /fill ~-8 ~-1 ~-2 ~8 ~-1 ~2 minecraft:gray_concrete
  4. /fill ~-2 ~-1 ~-8 ~2 ~-1 ~8 minecraft:gray_concrete
  5. /fill ~-8 ~-1 ~-8 ~-6 ~-1 ~-6 minecraft:gray_concrete
  6. /fill ~6 ~-1 ~-8 ~8 ~-1 ~-6 minecraft:gray_concrete
  7. /fill ~-8 ~-1 ~6 ~-6 ~-1 ~8 minecraft:gray_concrete
  8. /fill ~6 ~-1 ~6 ~8 ~-1 ~8 minecraft:gray_concrete
  9. /summon minecraft:block_display ~ ~2.2 ~ {Tags:["c9_light"],Glowing:1b,brightness:{sky:15,block:15},block_state:{Name:"minecraft:emerald_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.2f,1.2f,1.2f],translation:[-0.6f,0f,-0.6f]}}
  10. /summon minecraft:block_display ~-6 ~ ~1 {Tags:["c9_car"],Glowing:1b,Rotation:[270f,0f],teleport_duration:2,brightness:{sky:15,block:15},block_state:{Name:"minecraft:gold_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.9f,0.7f,1.5f],translation:[-0.45f,0f,-0.75f]}}

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

  1. /scoreboard players add #tick c9_t 1
  2. /execute if score #tick c9_t matches 140.. run scoreboard players set #tick c9_t 0
  3. /execute if score #tick c9_t matches 1 run fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:air
  4. /execute if score #tick c9_t matches 1 run data merge entity @e[tag=c9_light,limit=1] {block_state:{Name:"minecraft:emerald_block"}}
  5. /execute if score #tick c9_t matches 75 run fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:barrier
  6. /execute if score #tick c9_t matches 75 run data merge entity @e[tag=c9_light,limit=1] {block_state:{Name:"minecraft:redstone_block"}}
  7. /execute if score #tick c9_t matches 1 run kill @e[tag=c9_car]
  8. /execute if score #tick c9_t matches 2 run summon minecraft:block_display ~-6 ~ ~1 {Tags:["c9_car"],Glowing:1b,Rotation:[270f,0f],teleport_duration:2,brightness:{sky:15,block:15},block_state:{Name:"minecraft:gold_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.9f,0.7f,1.5f],translation:[-0.45f,0f,-0.75f]}}
  9. /execute if score #tick c9_t matches 25 run summon minecraft:block_display ~-1 ~ ~-6 {Tags:["c9_car"],Glowing:1b,Rotation:[0f,0f],teleport_duration:2,brightness:{sky:15,block:15},block_state:{Name:"minecraft:diamond_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.9f,0.7f,1.5f],translation:[-0.45f,0f,-0.75f]}}
  10. /execute if score #tick c9_t matches 50 run summon minecraft:block_display ~6 ~ ~-1 {Tags:["c9_car"],Glowing:1b,Rotation:[90f,0f],teleport_duration:2,brightness:{sky:15,block:15},block_state:{Name:"minecraft:amethyst_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.9f,0.7f,1.5f],translation:[-0.45f,0f,-0.75f]}}
  11. /execute as @e[tag=c9_car] at @s unless block ^ ^-1 ^1.2 minecraft:gray_concrete if block ^1.2 ^-1 ^ minecraft:gray_concrete run tp @s ~ ~ ~ ~-90 ~
  12. /execute as @e[tag=c9_car] at @s unless block ^ ^-1 ^1.2 minecraft:gray_concrete unless block ^1.2 ^-1 ^ minecraft:gray_concrete run tp @s ~ ~ ~ ~90 ~
  13. /execute as @e[tag=c9_car] at @s if block ^ ^-1 ^0.5 minecraft:gray_concrete unless block ^ ^ ^1.6 minecraft:barrier unless entity @e[tag=c9_car,distance=0.1..2.0] run tp @s ^ ^ ^0.25
  14. /execute at @e[tag=c9_car] run particle minecraft:dust{color:[1.0,0.7,0.1],scale:0.9} ^ ^0.35 ^-0.8 0.1 0 0.1 0 2

How it works

Frames from the test run

Self-Driving Block Display Traffic - frame 1Self-Driving Block Display Traffic - frame 2Self-Driving Block Display Traffic - frame 3

Recorded on our own test server: 59 frames at about 9.7 fps. Our image check saw: A miniature intersection on the ground features glowing rectangular block displays driving along dark paths with particle trails, while a central suspended block cycles between redstone (red) and emerald (green).

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 in the center of a flat open area with at least 10 blocks of space in every direction.
  2. Run each command from the Setup list in chat one by one to pave the road and spawn the traffic light.
  3. Place a column or line of 14 Repeating Command Blocks set to Always Active nearby.
  4. Paste one command from the Loop list into each repeating command block.
  5. Watch the block display cars spawn, navigate the figure-eight corners, and stop whenever the center light turns red.

Use it with real players

You can make the cars yield to real players walking across the street by adding unless entity @a[distance=..2.5] to loop command 13 right before run tp @s ^ ^ ^0.25. Whenever a player steps onto the crosswalk in front of a car, the vehicle will brake until the player moves out of the way.

Remove it again 5 commands

  1. /kill @e[tag=c9_car]
  2. /kill @e[tag=c9_light]
  3. /scoreboard objectives remove c9_t
  4. /fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:air
  5. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:grass_block

FAQ

Why do the cars move smoothly instead of teleporting in steps?

Each car is a block_display entity summoned with teleport_duration:2, which tells the Minecraft client to smoothly interpolate movement over 2 ticks every time the entity is teleported.

Can I design my own custom road layouts?

Yes! As long as you build the road out of gray_concrete and keep another block type on the borders, the cars will automatically follow straight paths and 90-degree corners.

Commands used

/data/execute/fill/kill/particle/scoreboard/summon/tp

Similar creations

Join 9Minecraft News & Guides