Go to file
Moritz Hölting 6abe437c70 implement tag declaration 2024-09-21 22:45:05 +02:00
src implement tag declaration 2024-09-21 22:45:05 +02:00
tests add SourceCodeDisplay to MissingFunctionDeclaration error 2024-08-27 22:55:26 +02:00
.gitignore Add tokenizing module 2024-03-27 19:27:11 +01:00
CHANGELOG.md implement tag declaration 2024-09-21 22:45:05 +02:00
Cargo.toml improve lua integration by allowing more flexible return types and introducing globals 2024-09-20 14:55:48 +02:00
LICENSE.txt update project metadata and license information 2024-06-10 10:29:37 +02:00
README.md add contributing section to readme 2024-06-10 16:27:33 +02:00
grammar.md implement tag declaration 2024-09-21 22:45:05 +02:00

README.md

ShulkerScript Language

ShulkerScript is a simple, easy-to-use scripting language for Minecraft datapacks. It is designed to be easy to learn and use, while still being powerful enough to create complex scripts, while not being hindered by Minecraft command limitations.

Usage

Add the following to your dependencies in Cargo.toml:

[dependencies]
shulkerscript-lang = { git = "https://github.com/moritz-hoelting/shulkerscript-lang" }

Features

Functions

#[load]
fn load() {
    /say Loaded!
    hello();
}

fn hello() {
    /say Hello, world!
}

Execute blocks

as("@a") { // execute as all players
    /say Hello, 
    /say world!
}

Chained execute blocks are also supported:

as("@a"), at("@s") { // execute as all players at the executing entity
    /setblock ~ ~ ~ minecraft:diamond_block
}

Conditionals

if("@s[tag=foo]" && "block ~ ~-1 ~ minecraft:stone") { // if the executing entity has the tag "foo" and is standing on stone
    /tag @s remove foo
    /say Hello, foo!
} else {
    /say Hello, world!
}

Unlike in mcfunction files, the actions in the conditional blocks are atomic, meaning that once the condition is fullfilled the actions are executed even after the condition is no longer fullfilled (in this case the "foo" tag has been removed).

Lua scripting

run lua() {
    -- Lua code goes here
    return "Hello, Lua!";
};

Full Grammar

The full grammar can be found here.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Note that this repository only contains the parser and transpiler to a secondary representation. The compilation to a Minecraft datapack is located in the shulkerbox repository. Please indicate if pull requests for this repository require pull requests for the shulkerbox repository