add project configuration reference

This commit is contained in:
Moritz Hölting 2024-06-10 16:12:13 +02:00
parent 8dacaa4011
commit 227b11e809
2 changed files with 30 additions and 1 deletions

View File

@ -39,12 +39,17 @@ Literal commands are just syntactic sugar for the [`run`](#run) keyword.
## Functions ## Functions
Functions are blocks of code that can be executed. 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. 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" ```shulkerscript title="src/main.shu"
#[tick] #[tick]
fn main() { fn main() {
/say Hello, world! /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. This code defines a function called `main` that will be executed every tick.

View File

@ -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"
```