Copying & pasting multiple commands to Minecraft terminal
Before functions and structure blocks existed, the best way to send someone a command block contraption was a "one-command-creation", which summoned a falling command block riding a falling command block riding a falling command block …
Currently there is a bug that breaks these: https://bugs.mojang.com/browse/MC-145113
But you can work around it by using other entities in between that instantly die. So you can for example do it like this:
summon falling_block ~ ~2 ~ {Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 1"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 2"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 3"}}]}]}]}]}
This executes all three commands, say 1
, say 2
and say 3
, in that order. If you also want to clean up afterwards, you can simply add another command block that removes the tower:
summon falling_block ~ ~2 ~ {Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 1"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 2"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"say 3"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"fill ~ ~-3 ~ ~ ~ ~ air"}}]}]}]}]}]}]}
Michael Dibbets/Tschallacka has created a generator in 2020 for these combined commands: https://www.tschallacka.de/minecraft/multiple-commands-generator (mirror, archive)
Enter your commands in the text field above the red button, one per line, without slashes in front (so like a function) and press the button. The bottom text field will then contain the combined command.
The generator does not validate if the commands are valid and it does not ignore empty lines or lines starting with #
, so you cannot simply copy-paste function files into it.
Licensing information on his profile (archive).
You could do this by writing a function (.mcfunction file) and placing it in a datapack in the map folder. To create a function, follow these steps:
- Open notepad (or your text editor of choice), and enter the commands you wish to run, each on their own line.
- Save the file, name it whatever you want, (replace .txt with .mcfunction) on your desktop.
-
Create folders in this order:
datapacks / [name of datapack] / data / [namespace] / functions
Move the .mcfunction file you created into the functions folder, and move the datapacks folder into your world folder. (for a Realm, you will first need to download the map - go to World backups and Download latest)
(for a Realm) Upload the modified map to the Realm.
Run the function with
/function [namespace] : [function name]
. This can be done by a player or from a command block.
Note: @p selector will be relative to the command block or player that ran the function, in this usecase I'm assuming @a would fit better.
You could have the pixel art already created then clone it to the position then play the bell sound to the player, this is best done with tags so everything goes to the right player .
One thing you could also do is to have a structure block with the commands already inside, then have setblock command that places preset structureblock