Skip to content

MCFunction_syntax

BubbleFish edited this page Feb 8, 2026 · 2 revisions

Vintage introduces new syntax to .mcfunction files.

If you're looking for a compatible syntax-highlighting tool check out tree-sitter-mcfunction. However, most tools like Spyglass MC should still work to a certain extent.

πŸ”– Definitions

  1. Resource β€” A Minecraft resource path, e.g. example:my/path/here.
  2. Indentation β€” A repeating sequence of tab (\t) or space ( ) characters. Any number of space characters can be used for a single unit of indentation, but it must be consistent throughout the document.

Relative resources

Any ./ characters will be expanded to the resource⁽¹⁾ of the current document (irrelevant of the indentation/nesting).

πŸ“ Input
# File: data/example/function/test.mcfunction                          
function ./nested_file
πŸ“¦οΈ Output
# File: data/example/function/test.mcfunction                          
function example:test/nested_file

Inline functions

Create inline functions by adding indentation⁽²⁾ to code, subsequent to any function call.

πŸ“ Input
# File: data/example/function/test.mcfunction                          
execute as @e run function ./_my_nested_function
    say 123
    kill @s
πŸ“¦οΈ Output (1/2)
# File: data/example/function/test.mcfunction                          
execute as @e run function example:test/_my_nested_function
πŸ“¦οΈ Output (2/2)
# File: data/example/function/test/_my_nested_function.mcfunction      
say 123
kill @s

Note

Vintage requires that the "parent" line ends with function <resource>, this implies that even comments can be used to define functions.

This can be used to create functions without necessarily calling them.

πŸ“ Input:

# File: data/example/function/test.mcfunction
# function example:create/this/but/dont/call/here
    say 123

πŸ“¦οΈ Output (1/2):

# File: data/example/function/test.mcfunction (empty)

πŸ“¦οΈ Output (2/2):

# File: data/example/function/create/this/but/dont/call/here.mcfunction
say 123

Template invocations

Inline templates can be called by using #~><name> <args?...> syntax.

🎯 Example
#~>for @s tmp ..5
    say 123

# This will call template "for" with arguments ["@s", "tmp", "..5"] and nested line ["say 123"].

πŸ“€ Getting Started

πŸ“šοΈ Features

🎁 Tutorials

🎲 Extras

Clone this wiki locally