From b8b1a4abe8c7623a1687ba48e1a66ccd6661d02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Sun, 22 Sep 2024 00:12:57 +0200 Subject: [PATCH] add github page and small corrections --- astro.config.mjs | 5 +- src/components/override/SocialIcons.astro | 26 +++++++++++ src/content/docs/github.mdx | 53 ++++++++++++++++++++++ src/content/docs/guides/syntax.md | 13 ++++-- src/content/docs/reference/conditionals.md | 4 ++ src/content/docs/reference/lua.md | 17 ++++++- 6 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 src/components/override/SocialIcons.astro create mode 100644 src/content/docs/github.mdx diff --git a/astro.config.mjs b/astro.config.mjs index 4269c9a..2a5f6c3 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -16,7 +16,7 @@ export default defineConfig({ favicon: '/favicon.ico', description: 'A simple and powerful scripting language for Minecraft datapacks.', social: { - github: 'https://github.com/moritz-hoelting/shulkerscript-cli', + email: 'mailto:shulkerscript@hoelting.dev', }, tableOfContents: { minHeadingLevel: 1, maxHeadingLevel: 3 }, defaultLocale: 'root', @@ -40,6 +40,9 @@ export default defineConfig({ expressiveCode: { shiki: shikiConfig, }, + components: { + SocialIcons: './src/components/override/SocialIcons.astro', + }, sidebar: [ { label: 'Guides', diff --git a/src/components/override/SocialIcons.astro b/src/components/override/SocialIcons.astro new file mode 100644 index 0000000..7fd35d1 --- /dev/null +++ b/src/components/override/SocialIcons.astro @@ -0,0 +1,26 @@ +--- +import type { Props } from "@astrojs/starlight/props"; +import Default from "@astrojs/starlight/components/SocialIcons.astro"; +import { Icon } from "@astrojs/starlight/components"; + +const localePrefix = Astro.currentLocale === "en" ? "" : `/${Astro.currentLocale}`; +--- + +<> + + + GitHub + + + + + diff --git a/src/content/docs/github.mdx b/src/content/docs/github.mdx new file mode 100644 index 0000000..5d1925a --- /dev/null +++ b/src/content/docs/github.mdx @@ -0,0 +1,53 @@ +--- +title: GitHub +description: View and contribute to the source code of ShulkerScript on GitHub. +--- + +import { CardGrid, LinkCard, Aside } from "@astrojs/starlight/components"; + +The source code of this project is hosted on GitHub. You can view and contribute to the project by visiting the repositories. + +## Organization + +The project is split into multiple repositories: + + + + + + + + +## Contributing + +First off, thanks for taking the time to contribute! ❤️ + +All types of contributions are encouraged and valued. The community looks forward to your contributions. 🎉 + + \ No newline at end of file diff --git a/src/content/docs/guides/syntax.md b/src/content/docs/guides/syntax.md index 3bcdf85..354bb15 100644 --- a/src/content/docs/guides/syntax.md +++ b/src/content/docs/guides/syntax.md @@ -1,10 +1,6 @@ --- title: Syntax description: Learn the syntax of ShulkerScript -sidebar: - badge: - text: WIP - variant: caution --- ## Comments @@ -158,6 +154,8 @@ if ("block ~ ~-1 ~ minecraft:stone") { } ``` +To learn more about how to combine or negate conditions, refer to the [if-else statement reference](/reference/conditionals). + ## Execute Blocks Execute blocks are used to execute a block of code in a specific context. They consist of the keyword you would pass to the `/execute` command followed the argument as a string in parenthesis and a block of code. @@ -190,6 +188,7 @@ positioned ("0 0 0"), in ("minecraft:overworld") { - `at` - `asat` - `facing` +- [`if`](#conditional-statements) - `in` - `on` - `positioned` @@ -197,6 +196,12 @@ positioned ("0 0 0"), in ("minecraft:overworld") { - `store` - `summon` +:::note +When using the summon execute block with multiple commands in it, only one entity will be summoned and all commands will be executed on that entity. If you want to summon multiple entities, you have to use multiple summon execute blocks. +::: + +For general information on the execute command, refer to the [Minecraft Wiki](https://minecraft.wiki/w/Commands/execute). + ## Groupings Groupings are used to group multiple commands into one `mcfunction` file without declaring a new function. This can be used for commands that need to be executed atomically. diff --git a/src/content/docs/reference/conditionals.md b/src/content/docs/reference/conditionals.md index 51a42d9..238ebc4 100644 --- a/src/content/docs/reference/conditionals.md +++ b/src/content/docs/reference/conditionals.md @@ -21,6 +21,10 @@ if ("block ~ ~-1 ~ minecraft:grass_block") { } ``` +:::note +Conditional statements are implemented to work atomically. This means that only the if or the else block will be executed, not both and only once, regardless of more than one condition being true. If either one is chosen, all commands in this block are run, even when a command before changes the state so the condition would be false. More about this can be found [here](/differences#interfering-with-conditions). +::: + ## Logical Operators Logical operators can be used to combine multiple conditions. The following logical operators are supported: diff --git a/src/content/docs/reference/lua.md b/src/content/docs/reference/lua.md index 30de189..f7bf160 100644 --- a/src/content/docs/reference/lua.md +++ b/src/content/docs/reference/lua.md @@ -19,4 +19,19 @@ run lua() { -- Lua code goes here return "Hello, Lua!"; }; -``` \ No newline at end of file +``` + +## Globals +The following globals are available in the Lua environment: +- `shu_location`: The relative filepath of the script being executed + +After variables are introduced in ShulkerScript, it is planned to make them available in the Lua environment as well. + +:::note +If you can think of any other globals that should be available in the Lua environment, please let us know! This could include: +- variables with values (like `shu_location`) +- functions that calculate/modify values (general utility things not provided by Lua or specific to ShulkerScript) +- functions that interact with the ShulkerScript environment (flags to set for the compiler to alter the build process) + +Please either write a mail or open an issue on GitHub. The links can be found in the upper right corner of the page. +::: \ No newline at end of file