Build an autonomous miniature traffic intersection in vanilla Minecraft using block displays that navigate roads, turn corners, and stop at red lights.
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.
/scoreboard objectives add c9_t dummy/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:polished_andesite/fill ~-8 ~-1 ~-2 ~8 ~-1 ~2 minecraft:gray_concrete/fill ~-2 ~-1 ~-8 ~2 ~-1 ~8 minecraft:gray_concrete/fill ~-8 ~-1 ~-8 ~-6 ~-1 ~-6 minecraft:gray_concrete/fill ~6 ~-1 ~-8 ~8 ~-1 ~-6 minecraft:gray_concrete/fill ~-8 ~-1 ~6 ~-6 ~-1 ~8 minecraft:gray_concrete/fill ~6 ~-1 ~6 ~8 ~-1 ~8 minecraft:gray_concrete/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]}}/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]}}/scoreboard players add #tick c9_t 1/execute if score #tick c9_t matches 140.. run scoreboard players set #tick c9_t 0/execute if score #tick c9_t matches 1 run fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:air/execute if score #tick c9_t matches 1 run data merge entity @e[tag=c9_light,limit=1] {block_state:{Name:"minecraft:emerald_block"}}/execute if score #tick c9_t matches 75 run fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:barrier/execute if score #tick c9_t matches 75 run data merge entity @e[tag=c9_light,limit=1] {block_state:{Name:"minecraft:redstone_block"}}/execute if score #tick c9_t matches 1 run kill @e[tag=c9_car]/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]}}/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]}}/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]}}/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 ~/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 ~/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/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 2setup #3 The road network is drawn on the ground using <code>gray_concrete</code> over a <code>polished_andesite</code> sidewalk base. The cars use these exact block types as sensors to know where the road goes.setup #9 Summons the overhead traffic light using a scaled glowing <code>block_display</code> centered over the intersection.loop #5 Halfway through the 140-tick cycle, a 3x3 patch of invisible <code>barrier</code> blocks is placed at the center of the intersection while the overhead display changes to a <code>redstone_block</code>.loop #11 Handles left turns: each car checks 1.2 blocks ahead and 1 block down (<code>^ ^-1 ^1.2</code>). If the gray concrete road ends ahead but continues to the left (<code>^1.2 ^-1 ^</code>), the car rotates -90 degrees.loop #13 Drives the cars forward by <code>0.25</code> blocks per tick using local coordinates (<code>^ ^ ^0.25</code>), but only if there is road ahead, no red-light barrier within 1.6 blocks, and no other car within 2.0 blocks.


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.
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.
/kill @e[tag=c9_car]/kill @e[tag=c9_light]/scoreboard objectives remove c9_t/fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:air/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:grass_blockEach 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.
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.
▶Steampunk Dirigible Anchor Winch MooringVehiclesMedium22 cmds
▶Holographic Wind Tunnel Aerodynamics TestVehiclesExpert25 cmds
▶Articulated Hydraulic Demolition ExcavatorVehiclesHard24 cmds
▶Phantom Express Bullet TrainVehiclesHard24 cmds
▶Spinning Biplane PropellerVehiclesMedium24 cmds
▶Armored Vigilante Block-Display CruiserVehiclesHard24 cmds