This is my take on generating single command in minecraft 1.16 Java edition. The program was originally written in Python, and was ported to JavaScript.
Python source code and command samples can be found in my GitHub. (link)
Any blank space or any line starting with # (hash comment) will be ignored.
Special kind of hash comments can be inserted before each command. These are prefixed by #@ [parameter]
.
Following table lists parameters that can be used. Note that some parameters apply on global context, meaning it will apply to all commands unless overridden by another parameter. Duplicated parameters are ignored.
Parameter | Group | Description | Context |
---|---|---|---|
keep | keep/remove | Keeps all command blocks after execution. | global |
optional | keep/remove | Keeps all command blocks after execution, but include a command block (second from bottom) to remove all blocks. | global |
remove | keep/remove | Removes all command blocks after execution. This is the default behavior. |
global |
remove+ | keep/remove | Removes all command blocks after execution. | global |
vertical | block stack | Command blocks are stacked upwards. This is the default behavior. |
global |
positive-x | block stack | First command blocks are stacked upwards, which then summons second command blocks that are placed horizontally towards east. | global |
positive-z | block stack | First command blocks are stacked upwards, which then summons second command blocks that are placed horizontally towards north. | global |
negative-x | block stack | First command blocks are stacked upwards, which then summons second command blocks that are placed horizontally towards west. | global |
negative-z | block stack | First command blocks are stacked upwards, which then summons second command blocks that are placed horizontally towards south. | global |
default [parameter] | - | Sets up default value for local parameters to be automatically applied. Only local context parameters are accpeted. |
global |
impulse | block type | Makes a command block to be in impulse mode. | local |
repeat | block type | Makes a command block to be in repeating mode. | local |
chain | block type | Makes a command block to be in chain mode. This is the default behavior. |
local |
auto | redstone power | Command block is always active, and no redstone power is needed. This is the default behavior. |
local |
manual | redstone power | Command block needs redstone to activate. | local |
conditional | conditional mode | Marks a command block conditional, requiring successful execution from previous block to activate. | local |
unconditional | conditional mode | Marks a command block unconditional. The command block executes right away with power. This is the default behavior. |
local |
up | face direction | Rotates command block to set direction. These option groups are only applied alongside non-vertical stack option. |
local |
down | face direction | Rotates command block to set direction. All vertical command blocks are always in down position. |
local |
east | face direction | Rotates command block to set direction. This is the default behavior for non-vertical stack option. |
local |
north | face direction | Rotates command block to set direction. | local |
west | face direction | Rotates command block to set direction. | local |
south | face direction | Rotates command block to set direction. | local |
Although we had glorious days of many one command block creations, such contraptions are becoming part of history as functions and datapacks proved to be more powerful. Still, pasing single command into a command block is much more convenient than creating own datapack from a scratch.
However, finding working one command generator online for latest minecraft update yields no good result. Summoning only a bunch of falling blocks will fail as they will just fall together at the same time, becoming item as they cannot be turned into blocks at that one place. Summoning a bunch of command block minecarts is still a viable option, but those are permanent entities, which may not be reliable.
This program sets up to summon a command block as falling block entity, on top of that is an invisible armor stand, and on top of that is another command block entity. This repeats to add an armor stand and a command block entity for each line of command.
When the bottom-most command block hits ground and turns into a block, it executes command to kill all invisible armor stands. This then allows all other commands to fall, with ehough space between them to nicely build up. This prevents them from falling all together at the same place and then breaking into item.
To ensure correct order of execution, the commands are designed to run top-down. All chain of commands start executing when the top-most command block entity hits ground and executes the whole chain of command blocks below.