From 227b11e809808ee48e9774e4e72fb8a2fef401f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:12:13 +0200 Subject: [PATCH] add project configuration reference --- src/content/docs/guides/syntax.md | 7 +++++- src/content/docs/reference/project-config.md | 24 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/content/docs/reference/project-config.md diff --git a/src/content/docs/guides/syntax.md b/src/content/docs/guides/syntax.md index 43d7220..9295f4a 100644 --- a/src/content/docs/guides/syntax.md +++ b/src/content/docs/guides/syntax.md @@ -39,12 +39,17 @@ Literal commands are just syntactic sugar for the [`run`](#run) keyword. ## Functions Functions are blocks of code that can be executed. They start with `fn` followed by the name of the function, parenthesis and a block of code. -Optionally they can be preceeded by annotations. +Optionally they can be preceeded by annotations. When a function has the `pub` keyword in front of it, it will be accessible from other files. ```shulkerscript title="src/main.shu" #[tick] fn main() { /say Hello, world! } + +#[deobfuscate] +pub fn hello() { + /say I can be called from other files! +} ``` This code defines a function called `main` that will be executed every tick. diff --git a/src/content/docs/reference/project-config.md b/src/content/docs/reference/project-config.md new file mode 100644 index 0000000..961b0e9 --- /dev/null +++ b/src/content/docs/reference/project-config.md @@ -0,0 +1,24 @@ +--- +title: Pack config reference +description: Reference for the pack.toml +--- + +The project is configured in the `pack.toml` file at the root of the project. It is automatically created when you create a new project with `shulkerscript init`. + +```toml +[pack] +# The name of the datapack +name = "shulkerpack" +# The description of the datapack +description = "I created this datapack with ShulkerScript" +# The pack format of the datapack (https://minecraft.wiki/w/Data_pack#Pack_format) +pack_format = 26 +# The version of the datapack (currently not used) +version = "0.1.0" + +[compiler] # optional +# path to the folder to use as a datapack template +# this folders files and subfolders will be copied to the root of the datapack +# optional +assets = "./assets" +``` \ No newline at end of file