-
Notifications
You must be signed in to change notification settings - Fork 0
MCFunction_syntax
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.
-
Resource β A Minecraft resource path, e.g.
example:my/path/here. -
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.
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 |
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 123Inline 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"]. |
Important
This Wiki is written for a project that does not yet exist.
Vintage is only partially implemented, you must wait until it is production ready.