add github page and small corrections

This commit is contained in:
Moritz Hölting 2024-09-22 00:12:57 +02:00
parent 3af5da0ba2
commit b8b1a4abe8
6 changed files with 112 additions and 6 deletions

View File

@ -16,7 +16,7 @@ export default defineConfig({
favicon: '/favicon.ico', favicon: '/favicon.ico',
description: 'A simple and powerful scripting language for Minecraft datapacks.', description: 'A simple and powerful scripting language for Minecraft datapacks.',
social: { social: {
github: 'https://github.com/moritz-hoelting/shulkerscript-cli', email: 'mailto:shulkerscript@hoelting.dev',
}, },
tableOfContents: { minHeadingLevel: 1, maxHeadingLevel: 3 }, tableOfContents: { minHeadingLevel: 1, maxHeadingLevel: 3 },
defaultLocale: 'root', defaultLocale: 'root',
@ -40,6 +40,9 @@ export default defineConfig({
expressiveCode: { expressiveCode: {
shiki: shikiConfig, shiki: shikiConfig,
}, },
components: {
SocialIcons: './src/components/override/SocialIcons.astro',
},
sidebar: [ sidebar: [
{ {
label: 'Guides', label: 'Guides',

View File

@ -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}`;
---
<>
<Default {...Astro.props} />
<a href={`${localePrefix}/github`} rel="me" class="sl-flex">
<span class="sr-only">GitHub</span>
<Icon name="github" />
</a>
</>
<style>
a {
color: var(--sl-color-text-accent);
padding: 0.5em;
margin: -0.5em;
}
a:hover {
opacity: 0.66;
}
</style>

View File

@ -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:
<LinkCard
title="shulkerscript-cli"
href="https://github.com/moritz-hoelting/shulkerscript-cli"
target="_blank"
description="This is the program you can download and use to compile the <code>.shu</code> files.
It is a wrapper for the library and depends on the other two repositories to do the actual work."
/>
<LinkCard
title="shulkerscript-lang"
href="https://github.com/moritz-hoelting/shulkerscript-lang"
target="_blank"
description="Library for parsing the syntax and transpiling to an intermediate representation.
Can be used in other rust programs to embed the language."
/>
<LinkCard
title="shulkerbox"
href="https://github.com/moritz-hoelting/shulkerbox"
target="_blank"
description="Library for compiling the intermediate representation to a datapack that can be read by Minecraft.
Also, provides an interface for constructing datapacks programatically in rust."
/>
<Aside type="note" title="Keep in mind">
Please raise issues in the respective repositories if it is related to a specific part of the project.
If you are unsure where to raise an issue, you can get help by contacting us via the email on the top right.
</Aside>
## 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. 🎉
<Aside type="tip" title="Other ways to support this project...">
And if you like the project, but just don't have the time or knowledge to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
- Star the project
- Refer this project in your project's readme
- Mention the project at local meetups and tell your friends/colleagues
</Aside>

View File

@ -1,10 +1,6 @@
--- ---
title: Syntax title: Syntax
description: Learn the syntax of ShulkerScript description: Learn the syntax of ShulkerScript
sidebar:
badge:
text: WIP
variant: caution
--- ---
## Comments ## 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
Execute blocks are used to execute a block of code in a specific context. 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. 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` - `at`
- `asat` - `asat`
- `facing` - `facing`
- [`if`](#conditional-statements)
- `in` - `in`
- `on` - `on`
- `positioned` - `positioned`
@ -197,6 +196,12 @@ positioned ("0 0 0"), in ("minecraft:overworld") {
- `store` - `store`
- `summon` - `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
Groupings are used to group multiple commands into one `mcfunction` file without declaring a new function. 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. This can be used for commands that need to be executed atomically.

View File

@ -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
Logical operators can be used to combine multiple conditions. The following logical operators are supported: Logical operators can be used to combine multiple conditions. The following logical operators are supported:

View File

@ -19,4 +19,19 @@ run lua() {
-- Lua code goes here -- Lua code goes here
return "Hello, Lua!"; return "Hello, Lua!";
}; };
``` ```
## 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.
:::