Skip to content

Comments and Multi-line Commands

Comments

MC-Build has three kinds of comments.

  • # comments are removed when MC-Build compiles your code.
  • \# comments are kept in the generated .mcfunction file, without the \. Use them for comments that you want to see in the output. They are only allowed inside functions and templates.
  • ### starts and ends a block comment. Each line in the block is kept in the output with ### before it.

Kept comments can contain inline scripts.

Examples

Comments

Code
function example {
    # This comment is removed
    \# This comment is kept
    \# Max players: <% 4 * 5 %>
    ###
    This block comment is kept
    ###
}
example.mcfunction
# This comment is kept
# Max players: 20
### This block comment is kept

To remove kept comments from the output too, set dontEmitComments to true in your configuration.

Multi-line Commands

End a line with \ to continue the command on the next line. MC-Build joins the lines into one command.

Examples

Multi-line Command

Code
function example {
    tellraw @a \
        {"text": "Hello"}
}
example.mcfunction
tellraw @a {"text": "Hello"}