Minecraft – Creating a minecart spawner that had blocks riding them

minecraft-commandsminecraft-java-edition

I know how in 1.7 you can summon a minecart that has a block "riding" it, as in you can change the block's height above it, what block it is, etc.

I also know how to make a minecart spawner.

How can i combine the two in order to create a minecart spawner with a block riding on the spawned carts?

I saw this on a server, it's a teleportation room and when you hit the button it puts a spawner below you, and you see this block whirl around you. Any ideas? This may also be part of a plugin, idk

Best Answer

You can create a minecart spawner with custom datatags with the following command:

/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {EntityId:MinecartRideable,SpawnData:{CustomDisplayTile:1,DisplayTile:1,DisplayData:0},SpawnPotentials:[{Type:MinecartRideable,Weight:1,Properties:{CustomDisplayTile:1,DisplayTile:1,DisplayData:0}}],SpawnCount:2}

The SpawnData and SpawnPotentials's Properties must contain the same tags in order for the spawner to continue spawning. SpawnData isn't really required as it will be overriden by SpawnPotentials after the first spawn, but I included it so the spawner would show the correct entity when created.

I'm not sure whether or not you use Block id's or names in 1.7, so you'll have to experiment with the DisplayTile yourself