Automated Bidirectional Railcar with Block Displays

Build a multi-part electric tram using block display entities that smoothly glides back and forth along a track with headlights, sparks, and station stops.

Java EditionHolograms & Display EntitiesHard24 commandsTested on a real 26.2 & 26.3 server
A custom crimson railcar with a sparking roof pantograph glides along a gravel track at night. Download the GIF Video & GIF © www.9minecraft.net

VehiclesTechnologyIndustrialRedWhiteCyanDecorationMap MakingServer LobbyBlock displaysSmooth animation (interpolation)Riding & passengersBlock building (fill/setblock/clone)Sounds21+ commands

Traditional Minecraft minecarts are limited to single-block carts on bumpy rails. Using block display entities and passenger mounting, you can assemble a multi-part electric tram that glides across a railway bed with smooth teleport interpolation.

This automated bidirectional railcar features a crimson body, tinted glass windows, glowing headlights, and a roof pantograph that emits electric sparks as it travels between two illuminated end stations.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_t dummy
  2. /scoreboard objectives add c9_dir dummy
  3. /fill ~-12 ~ ~-1 ~12 ~ ~1 gravel
  4. /fill ~-11 ~ ~ ~11 ~ ~ rail[shape=east_west]
  5. /setblock ~-12 ~ ~ chiseled_stone_bricks
  6. /setblock ~12 ~ ~ chiseled_stone_bricks
  7. /setblock ~-12 ~1 ~ sea_lantern
  8. /setblock ~12 ~1 ~ sea_lantern
  9. /summon block_display ~-8 ~0.2 ~ {Tags:["c9_train","c9_root"],teleport_duration:2,block_state:{Name:"minecraft:iron_block"},transformation:{translation:[-2.3f,0.2f,-1.1f],scale:[4.6f,0.25f,2.2f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},Passengers:[{id:"minecraft:block_display",Tags:["c9_train"],brightness:{sky:15,block:15},block_state:{Name:"minecraft:red_concrete"},transformation:{translation:[-2.2f,0.45f,-1.0f],scale:[4.4f,0.9f,2.0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_train"],brightness:{sky:15,block:15},block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{translation:[-2.1f,1.35f,-0.95f],scale:[4.2f,0.85f,1.9f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_train"],brightness:{sky:15,block:15},block_state:{Name:"minecraft:quartz_block"},transformation:{translation:[-2.25f,2.2f,-1.05f],scale:[4.5f,0.25f,2.1f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_train"],brightness:{sky:15,block:15},block_state:{Name:"minecraft:sea_lantern"},transformation:{translation:[-2.32f,0.65f,-0.3f],scale:[4.64f,0.3f,0.6f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_train"],brightness:{sky:15,block:15},block_state:{Name:"minecraft:lightning_rod"},transformation:{translation:[-0.4f,2.45f,-0.4f],scale:[0.8f,0.8f,0.8f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}
  10. /scoreboard players set @e[tag=c9_root] c9_dir 1

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

  1. /scoreboard players add @e[tag=c9_root] c9_t 1
  2. /execute as @e[tag=c9_root,scores={c9_dir=1,c9_t=1..106}] at @s run tp @s ~0.15 ~ ~
  3. /execute as @e[tag=c9_root,scores={c9_dir=-1,c9_t=1..106}] at @s run tp @s ~-0.15 ~ ~
  4. /execute as @e[tag=c9_root,scores={c9_t=1..106}] at @s run particle electric_spark ~ ~3.1 ~ 0.1 0.05 0.1 0.02 2
  5. /execute as @e[tag=c9_root,scores={c9_t=1..106}] at @s run particle smoke ~-1.4 ~0.1 ~ 0.1 0.02 0.3 0.01 1
  6. /execute as @e[tag=c9_root,scores={c9_t=1..106}] at @s run particle smoke ~1.4 ~0.1 ~ 0.1 0.02 0.3 0.01 1
  7. /execute as @e[tag=c9_root,scores={c9_t=107}] at @s run particle cloud ~ ~0.2 ~ 1.8 0.1 0.8 0.02 25
  8. /execute as @e[tag=c9_root,scores={c9_t=107}] at @s run playsound block.iron_trapdoor.close master @a ~ ~ ~ 0.8 0.7
  9. /execute as @e[tag=c9_root,scores={c9_t=107..129}] at @s run particle dust{color:[1.0,0.75,0.1],scale:1.2} ~ ~2.3 ~ 1.8 0.05 0.9 0 3
  10. /execute as @e[tag=c9_root,scores={c9_t=130}] at @s run playsound block.note_block.bell master @a ~ ~ ~ 1 1.5
  11. /execute as @e[tag=c9_root,scores={c9_t=130,c9_dir=1}] run scoreboard players set @s c9_dir 2
  12. /execute as @e[tag=c9_root,scores={c9_t=130,c9_dir=-1}] run scoreboard players set @s c9_dir 1
  13. /execute as @e[tag=c9_root,scores={c9_t=130,c9_dir=2}] run scoreboard players set @s c9_dir -1
  14. /execute as @e[tag=c9_root,scores={c9_t=130}] run scoreboard players set @s c9_t 0

How it works

Frames from the test run

Automated Bidirectional Railcar with Block Displays - frame 1Automated Bidirectional Railcar with Block Displays - frame 2Automated Bidirectional Railcar with Block Displays - frame 3

Recorded on our own test server: 69 frames at about 9.8 fps. Our image check saw: A custom multi-block crimson and white railcar with glass windows and a sparking lightning rod on top glides back and forth along a gravel track between two sea lanterns.

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 at the center of a flat open area where you want the 25-block railway track to appear.
  2. Run the 10 setup commands in order to create the scoreboards, build the gravel track bed and end bumpers, and summon the multi-part display railcar.
  3. Place 14 repeating command blocks (or 1 repeating command block leading into a chain of 13 chain command blocks), all set to Always Active.
  4. Paste the 14 loop commands into the command blocks in order.
  5. Watch the railcar glide smoothly between the two stations, braking with steam bursts and ringing a departure bell before reversing.

Use it with real players

To let players ride the railcar, add an invisible pig or boat with NoGravity:1b,Silent:1b,Invulnerable:1b to the Passengers list inside Setup command 9. Players can right-click the seat inside the glass cabin to ride smoothly back and forth along the line.

Remove it again 4 commands

  1. /kill @e[tag=c9_train]
  2. /fill ~-12 ~ ~-1 ~12 ~1 ~1 air
  3. /scoreboard objectives remove c9_t
  4. /scoreboard objectives remove c9_dir

FAQ

Why are all the parts mounted as Passengers on the base block display?

When block displays ride a root entity as passengers, teleporting only the root entity moves the entire vehicle simultaneously without subtle desyncs between parts, and requires only one /tp command per tick.

How do I make the railway track longer?

Extend the /fill coordinates in Setup commands 3 and 4, move the end bumpers further out, and increase the 106 tick travel limit in the loop commands (each tick travels 0.15 blocks).

Commands used

/execute/fill/particle/playsound/scoreboard/setblock/summon/tp

Similar creations

Join 9Minecraft News & Guides