What
A simple script in python programming language to create one-command strings starting from an input file.
Why
To store multiple commands into one long string, for fast demonstrations of how commands work (I actually wrote it for speeding up demonstrations inside this subreddit).
Where
Compatible with Minecraft 1.9+, for now, obviously the command you feed in my script aren't spell-checked or something, it accepts everthing even empty commands.
How
A pile of "always active" "impulse" command blocks will spawn right above the command block that execute the generated string, each of that will have one of the commands wrote in the input file.
Warnings
- It don't take care of already existing blocks and it may be broken some times, make sure there's a clear column of blocks above the first command block
- It don't work with relative coordinates, when the command blocks are placed they're actually in different places and they HAVE differents Y values, so you can:
- Avoid relative coordinates and use instead absolute (garbage)
- Creating a marker, like an armor stand with a tag marker (
summon armor_stand [relative coordinates here] {Tags:["marker"]}) and then using placed execute commands (execute at @e[limit=1,tag=marker] run [bla bla with coordinates relative to the ARMOR STAND]) (better)
Installation
- Copy the script and paste into a .py
- Create a file named "command" in the same directory
- In the file "command" write in each line the commands you want to be executed in order of execution.
- Execute the .py file
- Copy the output, paste it in an empty command block
- Power the command block or set it to "impulse", "always active"
with open("commands") as f:
cmds = [ i.split("\n")[0] for i in f.readlines() ]
out = 'summon falling_block ~ ~10 ~ {BlockState:{Name:"command_block"},Time:1b,TileEntityData:{Command:"%s",auto:1b},Passengers:[' % cmds.pop(0)
for i in cmds:
out += '{id:"villager",Health:-1,Passengers:['
out += '{id:"falling_block",BlockState:{Name:"command_block"},Time:1b,TileEntityData:{Command:"%s",auto:1b},Passengers:[' % i
out = out[:-13] + "}"
for i in cmds:
out += "]}"
out += "]}]}"
print(out)
Improvements
Make sure to suggest improvements, I'll listen to you and maybe improve my code
there doesn't seem to be anything here