diff --git a/mccompiled/docs/HelpTOC.json b/mccompiled/docs/HelpTOC.json index de07b9c..41fc0a3 100644 --- a/mccompiled/docs/HelpTOC.json +++ b/mccompiled/docs/HelpTOC.json @@ -1 +1 @@ -{"entities":{"pages":{"About":{"id":"About","title":"About","url":"about.html","level":0,"tabIndex":0},"Getting-Started":{"id":"Getting-Started","title":"Getting Started","url":"getting-started.html","level":0,"pages":["Installation","Compiling-Manually","Hello-World"],"tabIndex":1},"Installation":{"id":"Installation","title":"Installation","url":"installation.html","level":1,"parentId":"Getting-Started","pages":["Manual-Installation","Regolith-Installation"],"tabIndex":0},"Manual-Installation":{"id":"Manual-Installation","title":"Manual Installation","url":"manual-installation.html","level":2,"parentId":"Installation","tabIndex":0},"Regolith-Installation":{"id":"Regolith-Installation","title":"Regolith Installation","url":"regolith-installation.html","level":2,"parentId":"Installation","tabIndex":1},"Compiling-Manually":{"id":"Compiling-Manually","title":"Compiling Manually","url":"compiling-manually.html","level":1,"parentId":"Getting-Started","pages":["Extra-Compile-Options"],"tabIndex":1},"Extra-Compile-Options":{"id":"Extra-Compile-Options","title":"Extra Compile Options","url":"extra-compile-options.html","level":2,"parentId":"Compiling-Manually","tabIndex":0},"Hello-World":{"id":"Hello-World","title":"Hello, World!","url":"hello-world.html","level":1,"parentId":"Getting-Started","tabIndex":2},"Cheat-Sheet":{"id":"Cheat-Sheet","title":"Cheat Sheet","url":"cheat-sheet.html","level":0,"tabIndex":2},"Language":{"id":"Language","title":"Language","url":"language.html","level":0,"pages":["Syntax","Runtime","Preprocessor","Using-Colors","Debugging","Testing","Localization"],"tabIndex":3},"Syntax":{"id":"Syntax","title":"Syntax","url":"syntax.html","level":1,"parentId":"Language","tabIndex":0},"Runtime":{"id":"Runtime","title":"Runtime","url":"runtime.html","level":1,"parentId":"Language","pages":["Text-Commands","Values","Functions","Comparison","Loops","Indexing","Attributes","Commands-Deep-Dives","Add-On-Features"],"tabIndex":1},"Text-Commands":{"id":"Text-Commands","title":"Text Commands","url":"text-commands.html","level":2,"parentId":"Runtime","tabIndex":0},"Values":{"id":"Values","title":"Values","url":"values.html","level":2,"parentId":"Runtime","pages":["Types"],"tabIndex":1},"Types":{"id":"Types","title":"Types","url":"types.html","level":3,"parentId":"Values","tabIndex":0},"Functions":{"id":"Functions","title":"Functions","url":"functions.html","level":2,"parentId":"Runtime","pages":["Async","Built-In-Functions"],"tabIndex":2},"Async":{"id":"Async","title":"Async","url":"async.html","level":3,"parentId":"Functions","tabIndex":0},"Built-In-Functions":{"id":"Built-In-Functions","title":"Built-In Functions","url":"built-in-functions.html","level":3,"parentId":"Functions","tabIndex":1},"Comparison":{"id":"Comparison","title":"Comparison","url":"comparison.html","level":2,"parentId":"Runtime","tabIndex":3},"Loops":{"id":"Loops","title":"Loops","url":"loops.html","level":2,"parentId":"Runtime","tabIndex":4},"Indexing":{"id":"Indexing","title":"Indexing","url":"indexing.html","level":2,"parentId":"Runtime","tabIndex":5},"Attributes":{"id":"Attributes","title":"Attributes","url":"attributes.html","level":2,"parentId":"Runtime","tabIndex":6},"Commands-Deep-Dives":{"id":"Commands-Deep-Dives","title":"Commands Deep-Dives","url":"commands-deep-dives.html","level":2,"parentId":"Runtime","pages":["Scatter","Giving-Items"],"tabIndex":7},"Scatter":{"id":"Scatter","title":"Scatter","url":"scatter.html","level":3,"parentId":"Commands-Deep-Dives","tabIndex":0},"Giving-Items":{"id":"Giving-Items","title":"Giving Items","url":"giving-items.html","level":3,"parentId":"Commands-Deep-Dives","tabIndex":1},"Add-On-Features":{"id":"Add-On-Features","title":"Add-On Features","url":"add-on-features.html","level":2,"parentId":"Runtime","pages":["Dialogue","Playsound"],"tabIndex":8},"Dialogue":{"id":"Dialogue","title":"Dialogue","url":"dialogue.html","level":3,"parentId":"Add-On-Features","tabIndex":0},"Playsound":{"id":"Playsound","title":"Playsound","url":"playsound.html","level":3,"parentId":"Add-On-Features","tabIndex":1},"Preprocessor":{"id":"Preprocessor","title":"Preprocessor","url":"preprocessor.html","level":1,"parentId":"Language","pages":["Simple-Variable-Commands","Advanced-Variable-Commands","Compile-Time-Loops","Comparison-compile-time","JSON-Processing","Macros","Metaprogramming","Including-Other-Files"],"tabIndex":2},"Simple-Variable-Commands":{"id":"Simple-Variable-Commands","title":"Simple Variable Commands","url":"simple-variable-commands.html","level":2,"parentId":"Preprocessor","tabIndex":0},"Advanced-Variable-Commands":{"id":"Advanced-Variable-Commands","title":"Advanced Variable Commands","url":"advanced-variable-commands.html","level":2,"parentId":"Preprocessor","tabIndex":1},"Compile-Time-Loops":{"id":"Compile-Time-Loops","title":"Loops (compile-time)","url":"compile-time-loops.html","level":2,"parentId":"Preprocessor","tabIndex":2},"Comparison-compile-time":{"id":"Comparison-compile-time","title":"Comparison (compile-time)","url":"comparison-compile-time.html","level":2,"parentId":"Preprocessor","tabIndex":3},"JSON-Processing":{"id":"JSON-Processing","title":"JSON Processing","url":"json-processing.html","level":2,"parentId":"Preprocessor","tabIndex":4},"Macros":{"id":"Macros","title":"Macros","url":"macros.html","level":2,"parentId":"Preprocessor","tabIndex":5},"Metaprogramming":{"id":"Metaprogramming","title":"Metaprogramming","url":"metaprogramming.html","level":2,"parentId":"Preprocessor","tabIndex":6},"Including-Other-Files":{"id":"Including-Other-Files","title":"Including Other Files","url":"including-other-files.html","level":2,"parentId":"Preprocessor","tabIndex":7},"Using-Colors":{"id":"Using-Colors","title":"Using Colors","url":"using-colors.html","level":1,"parentId":"Language","tabIndex":3},"Debugging":{"id":"Debugging","title":"Debugging","url":"debugging.html","level":1,"parentId":"Language","tabIndex":4},"Testing":{"id":"Testing","title":"Testing","url":"testing.html","level":1,"parentId":"Language","tabIndex":5},"Localization":{"id":"Localization","title":"Localization","url":"localization.html","level":1,"parentId":"Language","tabIndex":6},"Optional-Features":{"id":"Optional-Features","title":"Optional Features","url":"optional-features.html","level":0,"tabIndex":4},"Changelog":{"id":"Changelog","title":"Changelog","url":"changelog.html","level":0,"tabIndex":5}}},"topLevelIds":["About","Getting-Started","Cheat-Sheet","Language","Optional-Features","Changelog"]} \ No newline at end of file +{"entities":{"pages":{"About":{"id":"About","title":"About","url":"about.html","level":0,"tabIndex":0},"Getting-Started":{"id":"Getting-Started","title":"Getting Started","url":"getting-started.html","level":0,"pages":["Installation","Compiling-Manually","Hello-World"],"tabIndex":1},"Installation":{"id":"Installation","title":"Installation","url":"installation.html","level":1,"parentId":"Getting-Started","pages":["Manual-Installation","Regolith-Installation"],"tabIndex":0},"Manual-Installation":{"id":"Manual-Installation","title":"Manual Installation","url":"manual-installation.html","level":2,"parentId":"Installation","tabIndex":0},"Regolith-Installation":{"id":"Regolith-Installation","title":"Regolith Installation","url":"regolith-installation.html","level":2,"parentId":"Installation","tabIndex":1},"Compiling-Manually":{"id":"Compiling-Manually","title":"Compiling Manually","url":"compiling-manually.html","level":1,"parentId":"Getting-Started","pages":["Extra-Compile-Options"],"tabIndex":1},"Extra-Compile-Options":{"id":"Extra-Compile-Options","title":"Extra Compile Options","url":"extra-compile-options.html","level":2,"parentId":"Compiling-Manually","tabIndex":0},"Hello-World":{"id":"Hello-World","title":"Hello, World!","url":"hello-world.html","level":1,"parentId":"Getting-Started","tabIndex":2},"Cheat-Sheet":{"id":"Cheat-Sheet","title":"Cheat Sheet","url":"cheat-sheet.html","level":0,"tabIndex":2},"Optional-Features":{"id":"Optional-Features","title":"Optional Features","url":"optional-features.html","level":0,"tabIndex":3},"Changelog":{"id":"Changelog","title":"Changelog","url":"changelog.html","level":0,"tabIndex":4},"Language":{"id":"Language","title":"Language","url":"language.html","level":0,"pages":["Syntax","Runtime","Preprocessor","Using-Colors","Debugging","Testing","Localization"],"tabIndex":5},"Syntax":{"id":"Syntax","title":"Syntax","url":"syntax.html","level":1,"parentId":"Language","tabIndex":0},"Runtime":{"id":"Runtime","title":"Runtime","url":"runtime.html","level":1,"parentId":"Language","pages":["Text-Commands","Values","Functions","Comparison","Loops","Indexing","Attributes","Commands-Deep-Dives","Add-On-Features"],"tabIndex":1},"Text-Commands":{"id":"Text-Commands","title":"Text Commands","url":"text-commands.html","level":2,"parentId":"Runtime","tabIndex":0},"Values":{"id":"Values","title":"Values","url":"values.html","level":2,"parentId":"Runtime","pages":["Types"],"tabIndex":1},"Types":{"id":"Types","title":"Types","url":"types.html","level":3,"parentId":"Values","tabIndex":0},"Functions":{"id":"Functions","title":"Functions","url":"functions.html","level":2,"parentId":"Runtime","pages":["Async","Built-In-Functions"],"tabIndex":2},"Async":{"id":"Async","title":"Async","url":"async.html","level":3,"parentId":"Functions","tabIndex":0},"Built-In-Functions":{"id":"Built-In-Functions","title":"Built-In Functions","url":"built-in-functions.html","level":3,"parentId":"Functions","tabIndex":1},"Comparison":{"id":"Comparison","title":"Comparison","url":"comparison.html","level":2,"parentId":"Runtime","tabIndex":3},"Loops":{"id":"Loops","title":"Loops","url":"loops.html","level":2,"parentId":"Runtime","tabIndex":4},"Indexing":{"id":"Indexing","title":"Indexing","url":"indexing.html","level":2,"parentId":"Runtime","tabIndex":5},"Attributes":{"id":"Attributes","title":"Attributes","url":"attributes.html","level":2,"parentId":"Runtime","tabIndex":6},"Commands-Deep-Dives":{"id":"Commands-Deep-Dives","title":"Commands Deep-Dives","url":"commands-deep-dives.html","level":2,"parentId":"Runtime","pages":["Scatter","Giving-Items"],"tabIndex":7},"Scatter":{"id":"Scatter","title":"Scatter","url":"scatter.html","level":3,"parentId":"Commands-Deep-Dives","tabIndex":0},"Giving-Items":{"id":"Giving-Items","title":"Giving Items","url":"giving-items.html","level":3,"parentId":"Commands-Deep-Dives","tabIndex":1},"Add-On-Features":{"id":"Add-On-Features","title":"Add-On Features","url":"add-on-features.html","level":2,"parentId":"Runtime","pages":["Dialogue","Playsound"],"tabIndex":8},"Dialogue":{"id":"Dialogue","title":"Dialogue","url":"dialogue.html","level":3,"parentId":"Add-On-Features","tabIndex":0},"Playsound":{"id":"Playsound","title":"Playsound","url":"playsound.html","level":3,"parentId":"Add-On-Features","tabIndex":1},"Preprocessor":{"id":"Preprocessor","title":"Preprocessor","url":"preprocessor.html","level":1,"parentId":"Language","pages":["Simple-Variable-Commands","Advanced-Variable-Commands","Compile-Time-Loops","Comparison-compile-time","JSON-Processing","Macros","Metaprogramming","Including-Other-Files"],"tabIndex":2},"Simple-Variable-Commands":{"id":"Simple-Variable-Commands","title":"Simple Variable Commands","url":"simple-variable-commands.html","level":2,"parentId":"Preprocessor","tabIndex":0},"Advanced-Variable-Commands":{"id":"Advanced-Variable-Commands","title":"Advanced Variable Commands","url":"advanced-variable-commands.html","level":2,"parentId":"Preprocessor","tabIndex":1},"Compile-Time-Loops":{"id":"Compile-Time-Loops","title":"Loops (compile-time)","url":"compile-time-loops.html","level":2,"parentId":"Preprocessor","tabIndex":2},"Comparison-compile-time":{"id":"Comparison-compile-time","title":"Comparison (compile-time)","url":"comparison-compile-time.html","level":2,"parentId":"Preprocessor","tabIndex":3},"JSON-Processing":{"id":"JSON-Processing","title":"JSON Processing","url":"json-processing.html","level":2,"parentId":"Preprocessor","tabIndex":4},"Macros":{"id":"Macros","title":"Macros","url":"macros.html","level":2,"parentId":"Preprocessor","tabIndex":5},"Metaprogramming":{"id":"Metaprogramming","title":"Metaprogramming","url":"metaprogramming.html","level":2,"parentId":"Preprocessor","tabIndex":6},"Including-Other-Files":{"id":"Including-Other-Files","title":"Including Other Files","url":"including-other-files.html","level":2,"parentId":"Preprocessor","tabIndex":7},"Using-Colors":{"id":"Using-Colors","title":"Using Colors","url":"using-colors.html","level":1,"parentId":"Language","tabIndex":3},"Debugging":{"id":"Debugging","title":"Debugging","url":"debugging.html","level":1,"parentId":"Language","tabIndex":4},"Testing":{"id":"Testing","title":"Testing","url":"testing.html","level":1,"parentId":"Language","tabIndex":5},"Localization":{"id":"Localization","title":"Localization","url":"localization.html","level":1,"parentId":"Language","tabIndex":6}}},"topLevelIds":["About","Getting-Started","Cheat-Sheet","Optional-Features","Changelog","Language"]} \ No newline at end of file diff --git a/mccompiled/docs/Map.jhm b/mccompiled/docs/Map.jhm index 53dff36..6c34b25 100644 --- a/mccompiled/docs/Map.jhm +++ b/mccompiled/docs/Map.jhm @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/mccompiled/docs/about.html b/mccompiled/docs/about.html index 25de6ac..b347f6f 100644 --- a/mccompiled/docs/about.html +++ b/mccompiled/docs/about.html @@ -1,9 +1,9 @@ -About | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

About

MCCompiled 1.18 is an open source programming language designed for anyone and everyone who writes Minecraft commands. It compiles code down to a behavior pack based on a context-aware compiler. MCCompiled code is intentionally built to mirror Minecraft commands but with many extended features.

Why?

Commands are hard. Not just because there are so many nuances to remember or that basically everything you make is a workaround of something else; There's just a lot of code to get a little bit done. Automation is the natural next step, but the way to approach it isn't immediately obvious given the technical hurdles of writing Minecraft commands in the first place.

MCCompiled takes a C-style approach to code, trying to abstract away some parts of Minecraft's command system while leaving others which are more desirable. Primarily, things like Scoreboard Objectives (values), Rawtext, Translation Keys, Control Flow, and Functions are focused on. Everything else is left untouched to prevent from needing to learn more than necessary.

+}

MCCompiled Wiki 1.18.1 Help

About

MCCompiled 1.18.1 is an open source programming language designed for anyone and everyone who writes Minecraft commands. It compiles code down to a behavior pack based on a context-aware compiler. MCCompiled code is intentionally built to mirror Minecraft commands but with many extended features.

Why?

Commands are hard. Not just because there are so many nuances to remember or that basically everything you make is a workaround of something else; There's just a lot of code to get a little bit done. Automation is the natural next step, but the way to approach it isn't immediately obvious given the technical hurdles of writing Minecraft commands in the first place.

MCCompiled takes a C-style approach to code, trying to abstract away some parts of Minecraft's command system while leaving others which are more desirable. Primarily, things like Scoreboard Objectives (values), Rawtext, Translation Keys, Control Flow, and Functions are focused on. Everything else is left untouched to prevent from needing to learn more than necessary.

define global int highScore define int score @@ -26,4 +26,4 @@ // reset the score of all players score[@a] = 0 } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/add-on-features.html b/mccompiled/docs/add-on-features.html index e2e79dd..40bfeb0 100644 --- a/mccompiled/docs/add-on-features.html +++ b/mccompiled/docs/add-on-features.html @@ -1,9 +1,9 @@ -Add-On Features | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Add-On Features

Some features in MCCompiled touch the area of addons. While sparse, they aim to add coverage to areas of addon development that lie very closely with commands, such that it's more convenient to have it built into the language.

The features shown in this subtopic are integrated with everything else in MCCompiled, despite being somewhat further away from commands.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Add-On Features

Some features in MCCompiled touch the area of addons. While sparse, they aim to add coverage to areas of addon development that lie very closely with commands, such that it's more convenient to have it built into the language.

The features shown in this subtopic are integrated with everything else in MCCompiled, despite being somewhat further away from commands.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/advanced-variable-commands.html b/mccompiled/docs/advanced-variable-commands.html index 73bfd95..b610ba9 100644 --- a/mccompiled/docs/advanced-variable-commands.html +++ b/mccompiled/docs/advanced-variable-commands.html @@ -1,9 +1,9 @@ -Advanced Variable Commands | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Advanced Variable Commands

Beyond simple addition, subtraction, and the likes of it, there are commands dedicated to some more advanced usages which will be touched on in detail here.

String Manipulation

There are three commands dedicated to modifying the way strings look. These are useful when fine-tuning some text that will be displayed to a user. These commands are good because MCCompiled doesn't feature a good way to manipulate strings character by character. Each command takes in two parameters; first, the identifier of the preprocessor variable that will hold the result. Second, the identifier of the input data.

If only one identifier is specified, the language assumes you want to destructively modify the input variable. It's better to do this only if you're no longer going to use the original data.

All of these commands perform their operation on all values in the preprocessor variable. So, running $strupper on a set of hello world would result in HELLO WORLD. If one of the values in the input is not a string, it is left untouched.

Preprocessor String Uppercase

Transforms the given input string(s) to UPPERCASE.

Preprocessor String Lowercase

Transforms the given input string(s) to lowercase.

Preprocessor String Friendly Name

Transforms the given input string(s) to Title Case, which is more user-friendly. Additionally, converts any characters like _ or - to spaces for user display.

Data Manipulation

These commands focus on extrapolating info from data (generally numbers) inside an array of objects. Each of them takes in two parameters; first, the identifier of the preprocessor variable that will hold the result. Second, the identifier of the input data.

If only one identifier is specified, the language assumes you want to destructively modify the input variable. It's better to do this only if you're no longer going to use the original data.

Preprocessor Array Sum

Retrieve the sum of all elements in the given array.

Preprocessor Array Median

Retrieve the middle element of the given data, or the average of the two middle values if even.

Preprocessor Array Mean

Retrieve the mean (average) of all the elements in the given array.

Preprocessor Array Length

Retrieve the number of elements (length) in the given array.

Array-Specific Manipulation

These commands are dedicated to manipulating preprocessor arrays, and don't really serve a purpose on variables with single values. All of these commands destructively modify a single parameter, which is the identifier of the variable to modify.

Preprocessor Array Sort

Sorts the values in the given array either ascending or descending.

Use the syntax: $sort [ascending|descending] [id: variable]

Preprocessor Array Reverse

Reverse the order of the elements in the given array.

Preprocessor Array Unique Values

Prune all non-unique values from the given array; as in, any value which == another value in the array.

Preprocessor Array Append

Adds the given item(s) to the end of the given preprocessor variable, or contents of another preprocessor variable if specified.

Preprocessor Array Prepend

Adds the given item(s) to the start of the given preprocessor variable, or contents of another preprocessor variable if specified.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Advanced Variable Commands

Beyond simple addition, subtraction, and the likes of it, there are commands dedicated to some more advanced usages which will be touched on in detail here.

String Manipulation

There are three commands dedicated to modifying the way strings look. These are useful when fine-tuning some text that will be displayed to a user. These commands are good because MCCompiled doesn't feature a good way to manipulate strings character by character. Each command takes in two parameters; first, the identifier of the preprocessor variable that will hold the result. Second, the identifier of the input data.

If only one identifier is specified, the language assumes you want to destructively modify the input variable. It's better to do this only if you're no longer going to use the original data.

All of these commands perform their operation on all values in the preprocessor variable. So, running $strupper on a set of hello world would result in HELLO WORLD. If one of the values in the input is not a string, it is left untouched.

Preprocessor String Uppercase

Transforms the given input string(s) to UPPERCASE.

Preprocessor String Lowercase

Transforms the given input string(s) to lowercase.

Preprocessor String Friendly Name

Transforms the given input string(s) to Title Case, which is more user-friendly. Additionally, converts any characters like _ or - to spaces for user display.

Data Manipulation

These commands focus on extrapolating info from data (generally numbers) inside an array of objects. Each of them takes in two parameters; first, the identifier of the preprocessor variable that will hold the result. Second, the identifier of the input data.

If only one identifier is specified, the language assumes you want to destructively modify the input variable. It's better to do this only if you're no longer going to use the original data.

Preprocessor Array Sum

Retrieve the sum of all elements in the given array.

Preprocessor Array Median

Retrieve the middle element of the given data, or the average of the two middle values if even.

Preprocessor Array Mean

Retrieve the mean (average) of all the elements in the given array.

Preprocessor Array Length

Retrieve the number of elements (length) in the given array.

Array-Specific Manipulation

These commands are dedicated to manipulating preprocessor arrays, and don't really serve a purpose on variables with single values. All of these commands destructively modify a single parameter, which is the identifier of the variable to modify.

Preprocessor Array Sort

Sorts the values in the given array either ascending or descending.

Use the syntax: $sort [ascending|descending] [id: variable]

Preprocessor Array Reverse

Reverse the order of the elements in the given array.

Preprocessor Array Unique Values

Prune all non-unique values from the given array; as in, any value which == another value in the array.

Preprocessor Array Append

Adds the given item(s) to the end of the given preprocessor variable, or contents of another preprocessor variable if specified.

Preprocessor Array Prepend

Adds the given item(s) to the start of the given preprocessor variable, or contents of another preprocessor variable if specified.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/async.html b/mccompiled/docs/async.html index 11ecc3f..ec59118 100644 --- a/mccompiled/docs/async.html +++ b/mccompiled/docs/async.html @@ -1,9 +1,9 @@ -Async | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Async

In a world of schedulers, state machines, and loads of nested functions, MCCompiled's async implementation is built to remove ALL boilerplate and focus entirely on logic and structure.

Async functions generate state machines automatically, set up to either run locally on an entity, or globally without any executing context (directly from tick.json).

Defining

To define an async function, the attribute async can be used. The attribute accepts one parameter, being the word global or local, which defines if the async state machine should be run globally, or on the executing entity only.

+}

MCCompiled Wiki 1.18.1 Help

Async

In a world of schedulers, state machines, and loads of nested functions, MCCompiled's async implementation is built to remove ALL boilerplate and focus entirely on logic and structure.

Async functions generate state machines automatically, set up to either run locally on an entity, or globally without any executing context (directly from tick.json).

Defining

To define an async function, the attribute async can be used. The attribute accepts one parameter, being the word global or local, which defines if the async state machine should be run globally, or on the executing entity only.

// does a countdown before starting the game. function async(global) countdown() { @@ -23,7 +23,7 @@ function async(local) giveDiamondLater() { } -

Awaiting

The await command is only usable inside async functions. It allows you to wait for a specific amount of time, wait for a condition to be met, or wait for another async function to finish executing.

Awaiting an amount of time

This is the most common use of async code. To await a certain amount of time, use the syntax await <time>, with time being the number of ticks to wait. You can use time suffixes to make this number more concisely defined.

+

Awaiting

The await command is only usable inside async functions. It allows you to wait for a specific amount of time, wait for a condition to be met, or wait for another async function to finish executing.

Awaiting an amount of time

This is the most common use of async code. To await a certain amount of time, use the syntax await <time>, with time being the number of ticks to wait. You can use time suffixes to make this number more concisely defined.

function async(global) countdown() { globalprint "Three..." await 1s @@ -33,7 +33,7 @@ await 1s globaltitle "GO!" } -

Awaiting a condition

To await a condition, use either syntax depending on what makes the most sense:

  • await until <condition>

  • await while <condition>

These will wait until the given condition is true/false respectively to continue execution. You can wait until a condition is met, or wait while a condition is met.

The conditions that can be used are the same as what's available with if statements, while loops, etc.

+

Awaiting a condition

To await a condition, use either syntax depending on what makes the most sense:

  • await until <condition>

  • await while <condition>

These will wait until the given condition is true/false respectively to continue execution. You can wait until a condition is met, or wait while a condition is met.

The conditions that can be used are the same as what's available with if statements, while loops, etc.

function async(local) forceGrabBow() { if not @s[hasitem={item=bow}}] { print "Grab the bow." @@ -42,7 +42,7 @@ // ... } -

Awaiting another function

To wait for another async function to complete its execution, call it and pass the result as a parameter to await. Async functions return an awaitable, and as such are not able to return any other type of value.

+

Awaiting another function

To wait for another async function to complete its execution, call it and pass the result as a parameter to await. Async functions return an awaitable, and as such are not able to return any other type of value.

function async(global) countdown(int seconds) { repeat seconds i { print "Round starts in {seconds + 1}..." @@ -56,4 +56,4 @@ round += 1 running = true } -

Warning as of 1.18

Last modified: 24 April 2024
\ No newline at end of file +

Warning as of 1.18

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/attributes.html b/mccompiled/docs/attributes.html index 4c99769..2b39b4d 100644 --- a/mccompiled/docs/attributes.html +++ b/mccompiled/docs/attributes.html @@ -1,9 +1,9 @@ -Attributes | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Attributes

Attributes are modifiers that change the way values or functions work. They can be specified in most places in definition commands (define or function).

Value Attributes

The following contains all attributes that can be applied to values, as well as examples and use-cases where applicable.

global

Makes the attached value global, meaning that the value's scoreboard objectives are always tied to the global fakeplayer _.


Any attempts to use clarifiers on the value will result in a compile-time error. The value is guaranteed to never be attached to an entity.

Examples & Use-case

Making values global is useful for anything that applies to the world, and not a specific player/entity. If you were designing a mini-game, for example, you would want the game-related code to be global, along with the compile-time guarantees that it will remain global.

+}

MCCompiled Wiki 1.18.1 Help

Attributes

Attributes are modifiers that change the way values or functions work. They can be specified in most places in definition commands (define or function).

Value Attributes

The following contains all attributes that can be applied to values, as well as examples and use-cases where applicable.

global

Makes the attached value global, meaning that the value's scoreboard objectives are always tied to the global fakeplayer _.


Any attempts to use clarifiers on the value will result in a compile-time error. The value is guaranteed to never be attached to an entity.

Examples & Use-case

Making values global is useful for anything that applies to the world, and not a specific player/entity. If you were designing a mini-game, for example, you would want the game-related code to be global, along with the compile-time guarantees that it will remain global.

define global int playersPassed define global time timeRemaining ‎ function display { globalprint "PASSED: {playersPassed} | TIME LEFT: {timeRemaining}" } -
bind

Binds the value to a given MoLang query. Requires one parameter, being a string that contains the query to use. The current list of supported bindings is here.


Most bindings come with pre-defined entities they attach to, but in cases where they don't, the entities can be manually specified by adding more string parameters to the end of the function, i.e., bind("query.is_sleeping", "fox") to bind specifically to foxes.

Examples & Use-case

Binding replaces all cases where animation controllers were needed to access extra information about entities.

+
bind

Binds the value to a given MoLang query. Requires one parameter, being a string that contains the query to use. The current list of supported bindings is here.


Most bindings come with pre-defined entities they attach to, but in cases where they don't, the entities can be manually specified by adding more string parameters to the end of the function, i.e., bind("query.is_sleeping", "fox") to bind specifically to foxes.

Examples & Use-case

Binding replaces all cases where animation controllers were needed to access extra information about entities.

define bool bind("query.is_sleeping") isSleeping ‎ if not isSleeping { summon lightning_bolt print @a "{@s} IS RUINING THE SMP!!!" } -

Function Attributes

The following contains all attributes that can be applied to functions, as well as examples and use-cases where applicable.

extern

Makes a function external. External functions cannot have code in them, and their parameter names are interpreted verbatim. These functions will call the .mcfunction that matches their name and folder, making them great for combining MCCompiled with optimized handwritten functions or code from non-MCCompiled users.

Examples & Use-case

In cases where you have an .mcfunction file that cannot be ported or is not necessary to port over, it's better to declare an external function; making it possible to call the .mcfunction directly.

+

Function Attributes

The following contains all attributes that can be applied to functions, as well as examples and use-cases where applicable.

extern

Makes a function external. External functions cannot have code in them, and their parameter names are interpreted verbatim. These functions will call the .mcfunction that matches their name and folder, making them great for combining MCCompiled with optimized handwritten functions or code from non-MCCompiled users.

Examples & Use-case

In cases where you have an .mcfunction file that cannot be ported or is not necessary to port over, it's better to declare an external function; making it possible to call the .mcfunction directly.

// BP/functions/library/example.mcfunction function extern library.example ‎ library.example() -
export

Marks a function for export. The function and any functions it calls will always be exported whether they're in use or not. See more about usage/exports here.

Examples & Use-case

Excluding unused files is beneficial for many projects, but sometimes you'll have functions you run in-game through a command block, the /function command, or other methods MCCompiled doesn't know about. The export attribute covers those edge cases. In this example, the user wants to run /function reset in game.

+
export

Marks a function for export. The function and any functions it calls will always be exported whether they're in use or not. See more about usage/exports here.

Examples & Use-case

Excluding unused files is beneficial for many projects, but sometimes you'll have functions you run in-game through a command block, the /function command, or other methods MCCompiled doesn't know about. The export attribute covers those edge cases. In this example, the user wants to run /function reset in game.

function export reset { kill @e[type=item] itemsCollected[*] = 0 print "Reset everything!" } -
auto

Makes the function automatically run every tick; or, if specified, at an interval. If the attribute is specified as-is, the function will be marked as "in use" and added to tick.json. If a parameter is given in ticks, the function will run on that interval using an auto-generated timer.

Examples & Use-case

Anywhere tick.json is needed, or something needs to happen on a timer, the auto attribute saves lots of boilerplate code and clearly communicates which functions automatically run. In the example below, time suffixes are used instead of tick count.

+
auto

Makes the function automatically run every tick; or, if specified, at an interval. If the attribute is specified as-is, the function will be marked as "in use" and added to tick.json. If a parameter is given in ticks, the function will run on that interval using an auto-generated timer.

Examples & Use-case

Anywhere tick.json is needed, or something needs to happen on a timer, the auto attribute saves lots of boilerplate code and clearly communicates which functions automatically run. In the example below, time suffixes are used instead of tick count.

function auto everyTick { // logic to run every tick. } function auto(1s) everySecond { // logic to run once a second. } -
partial

Makes a function partially implemented. When a function is partial, you can re-define it later as many times as you want, with each one appending its contents to the original function.

Examples & Use-case

Partial functions are useful with metaprogramming or forward declaration, where you may want to use a function before its actual implementation. The following example shows how a function can be defined in two different places with their results merged.

+
partial

Makes a function partially implemented. When a function is partial, you can re-define it later as many times as you want, with each one appending its contents to the original function.

Examples & Use-case

Partial functions are useful with metaprogramming or forward declaration, where you may want to use a function before its actual implementation. The following example shows how a function can be defined in two different places with their results merged.

function partial example { print "One!" } @@ -56,4 +56,4 @@ example() // One! // Two! -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/built-in-functions.html b/mccompiled/docs/built-in-functions.html index 9b6b6b7..19a9025 100644 --- a/mccompiled/docs/built-in-functions.html +++ b/mccompiled/docs/built-in-functions.html @@ -1,9 +1,9 @@ -Built-In Functions | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Built-In Functions

MCCompiled ships with a list of built-in functions which are already implemented for your use. Functions can either support compile-time, runtime, or both.

When a function supports runtime, it follows the same rules as functions, as in, it is only included in your project's output when it's used somewhere in your code.

Utility Functions

These functions are miscellaneous useful utilities that can help with writing MCCompiled code. Metaprogramming, math, and other various functions allow you to write better code.

Get Value by Name

getValue(name) compile-time


Fetches a value by the given name and returns it to be used as if its identifier was specified. An example of this in action looks like the following:

+}

MCCompiled Wiki 1.18.1 Help

Built-In Functions

MCCompiled ships with a list of built-in functions which are already implemented for your use. Functions can either support compile-time, runtime, or both.

When a function supports runtime, it follows the same rules as functions, as in, it is only included in your project's output when it's used somewhere in your code.

Utility Functions

These functions are miscellaneous useful utilities that can help with writing MCCompiled code. Metaprogramming, math, and other various functions allow you to write better code.

Get Value by Name

getValue(name) compile-time


Fetches a value by the given name and returns it to be used as if its identifier was specified. An example of this in action looks like the following:

define int exampleValue ‎ getValue("exampleValue") = 40 -
Fetch E0 Glyph

glyphE0(x, y = 0) compile-time


Fetches the character at a coordinate in glyph_E0.png and returns it as a string literal. The coordinate 0, 0 is the top left.

Fetch E1 Glyph

glyphE1(x, y = 0) compile-time


Fetches the character at a coordinate in glyph_E1.png and returns it as a string literal. The coordinate 0, 0 is the top left.

Minimum

min(a, b) compile-time, runtime


Returns the smaller of the two inputs.

Maximum

max(a, b) compile-time, runtime


Returns the larger of the two inputs.

Count Entities

countEntities(selector) runtime


Returns the number of entities which match the input selector as an integer.

+
Fetch E0 Glyph

glyphE0(x, y = 0) compile-time


Fetches the character at a coordinate in glyph_E0.png and returns it as a string literal. The coordinate 0, 0 is the top left.

Fetch E1 Glyph

glyphE1(x, y = 0) compile-time


Fetches the character at a coordinate in glyph_E1.png and returns it as a string literal. The coordinate 0, 0 is the top left.

Minimum

min(a, b) compile-time, runtime


Returns the smaller of the two inputs.

Maximum

max(a, b) compile-time, runtime


Returns the larger of the two inputs.

Count Entities

countEntities(selector) runtime


Returns the number of entities which match the input selector as an integer.

define int players ‎ players = countEntities(@a) -

Math Functions

These functions work with numbers and computation beyond what the operators can do.

Square Root

sqrt(n) compile-time


Returns the square root of n. Runtime support is planned eventually.

Sine

sin(n) compile-time


Returns the sine of n. Runtime support is planned eventually.

Cosine

cos(n) compile-time


Returns the co-sine of n. Runtime support is planned eventually.

Tangent

tan(n) compile-time


Returns the tangent of n. Runtime support is planned eventually.

Arc-tangent

arctan(n) compile-time


Returns the angle that has a tangent of n. Runtime support is planned eventually.

Rounding Functions

These functions focus on decimal numbers; specifically, rounding them to integers in different ways.

Round

round(n) compile-time, runtime


Rounds the given number to the nearest integer. If the number is a midpoint (e.g., 1.5), the number is rounded up.

Floor

floor(n) compile-time, runtime


Rounds the given number to the nearest integer that is less or equal to it. Generally referred to as "rounding down."

Ceiling

ceiling(n) compile-time, runtime


Rounds the given number to the nearest integer that is greater or equal to it. Generally referred to as "rounding up."

Last modified: 24 April 2024
\ No newline at end of file +

Math Functions

These functions work with numbers and computation beyond what the operators can do.

Square Root

sqrt(n) compile-time


Returns the square root of n. Runtime support is planned eventually.

Sine

sin(n) compile-time


Returns the sine of n. Runtime support is planned eventually.

Cosine

cos(n) compile-time


Returns the co-sine of n. Runtime support is planned eventually.

Tangent

tan(n) compile-time


Returns the tangent of n. Runtime support is planned eventually.

Arc-tangent

arctan(n) compile-time


Returns the angle that has a tangent of n. Runtime support is planned eventually.

Rounding Functions

These functions focus on decimal numbers; specifically, rounding them to integers in different ways.

Round

round(n) compile-time, runtime


Rounds the given number to the nearest integer. If the number is a midpoint (e.g., 1.5), the number is rounded up.

Floor

floor(n) compile-time, runtime


Rounds the given number to the nearest integer that is less or equal to it. Generally referred to as "rounding down."

Ceiling

ceiling(n) compile-time, runtime


Rounds the given number to the nearest integer that is greater or equal to it. Generally referred to as "rounding up."

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/changelog.html b/mccompiled/docs/changelog.html index 80b7b31..3df3ee6 100644 --- a/mccompiled/docs/changelog.html +++ b/mccompiled/docs/changelog.html @@ -1,9 +1,9 @@ -Changelog | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Changelog

MCCompiled 1.18

Another feature update, baby! Loops, loads of new exceptions, and async.

Additions

  • Added while command.

  • Added repeat command. Differs from the compile-time version as it is runtime-only.

  • Added countEntities(selector) function which counts the number of matching entities.

  • Added support for checking for spectator mode in selectors.

  • Added --trace compiler option for tracing the execution path in chat; used only for debugging.

  • New bindings for bind attribute:

  • Added query.is_baby

  • Added query.is_carrying_block (endermen)

  • Added query.is_sitting (foxes, wolves/dogs, parrots)

  • Added query.is_sneezing (llamas)

  • Added query.is_transforming (zombies/husks)

  • Added query.is_tamed

  • Added query.is_elder (guardians)

  • Added summon command; matches vanilla syntax.

Additions: Errors

Added loads of errors where previously the code was ignored. If some of your code is causing errors after these changes, it's most likely safe to remove the problematic parts because it wasn't valid; probably not even being processed in the first place.

  • Added 7 new errors for conditions.

  • Added 3 new errors for function definitions.

  • Added 2 new errors for give command.

  • Added an error for attempting to apply duplicate attributes to functions.

  • Added an error for when tokens at the end of statements go unused (not including comments).

Additions: Async

Additions: Web Editor

Planning on focusing on LSP for 1.19 and integrating into VSCode, but since the web editor is already VSCode based, these fixes are an essential step regardless.

  • Updated to Monaco 0.47.0

  • Sticky lines support.

  • Enabled code mini-map only when hovered (right-side).

  • Set default font to Jetbrains Mono

  • Added button to switch to Minecraft Font (Monocraft)

Changes

  • Changed exporter udl2.1 to notepadplusplus for clarity.

  • Overhauled raw exporter to output JSON and much more information.

  • Added raw-min exporter, which is just the minimized version of raw.

Bugfixes

  • Made throw show source code rather than compiled code (including location).

  • MCCompiled now internally strips inline comments away to prevent unexpected errors.

  • Full-line comments still remain for uses like documentation; just inline comments are stripped.

  • Decimals multiplied using time suffixes are once again interpreted as integers (e.g., 0.5s)

  • playsound command no longer requires a selector, defaulting to @s if unspecified.

  • Fixed function re-definitions (e.g., partials or overloads) being interpreted as a call if there were parentheses.

  • (Web Editor) Autocomplete no longer triggers inside comments or strings.

  • (Web Editor) Unclosed strings are now highlighted.

  • All generated file names now use consistent camelCase formatting.

MCCompiled 1.17.1

  • Fixed new manifests not being created.

  • Fixed GitHub "wiki" URL not directing to the new wiki.

MCCompiled 1.17

Dialogue, more marketplace stuff, and loads of bugfixes.

Additions: Dialogue Support

  • dialogue new <name> { ... }

+}

MCCompiled Wiki 1.18.1 Help

Changelog

MCCompiled 1.18.1

Hotfix for a ton of important production issues, and some new bindings stuff.

Additions

  • Added new binding type custom_bool which accepts a string: condition for determining the binding state.

  • Added binding is_day which checks query.time_of_day inside a threshold (unable to sleep).

  • Added binding is_night which checks query.time_of_day inside a threshold (able to sleep).

  • Added compile option/editor property IGNORE_MANIFESTS which makes MCCompiled not touch manifest files.

    • This is just here for edge cases; most users will not need this.

  • Added automatic updates to manifest min_engine_version when MCCompiled requires it.

Bugfixes

  • Rewrote Manifest parser to support script modules and many more edge cases.

    • The new abstraction should also allow faster rollouts of fixes/additions for the parser.

  • Value definition duplicates are now ignored if they're identical. This allows you to define in macros.

  • You are now able to create empty macros; pointless limitation.

  • Fixed wording of errors relating to selectors that should only target players.

  • No longer crashes when trying to fetch JSON files from the default pack.

  • $log no longer errors when linting (but not when compiling).

  • Starting the mc command's input with / no longer causes it to compile incorrectly.

  • Using \n in format strings with localization enabled no longer fails.

MCCompiled 1.18

Another feature update, baby! Loops, loads of new exceptions, and async.

Additions

  • Added while command.

  • Added repeat command. Differs from the compile-time version as it is runtime-only.

  • Added countEntities(selector) function which counts the number of matching entities.

  • Added support for checking for spectator mode in selectors.

  • Added --trace compiler option for tracing the execution path in chat; used only for debugging.

  • New bindings for bind attribute:

  • Added query.is_baby

  • Added query.is_carrying_block (endermen)

  • Added query.is_sitting (foxes, wolves/dogs, parrots)

  • Added query.is_sneezing (llamas)

  • Added query.is_transforming (zombies/husks)

  • Added query.is_tamed

  • Added query.is_elder (guardians)

  • Added summon command; matches vanilla syntax.

Additions: Errors

Added loads of errors where previously the code was ignored. If some of your code is causing errors after these changes, it's most likely safe to remove the problematic parts because it wasn't valid; probably not even being processed in the first place.

  • Added 7 new errors for conditions.

  • Added 3 new errors for function definitions.

  • Added 2 new errors for give command.

  • Added an error for attempting to apply duplicate attributes to functions.

  • Added an error for when tokens at the end of statements go unused (not including comments).

Additions: Async

Additions: Web Editor

Planning on focusing on LSP for 1.19 and integrating into VSCode, but since the web editor is already VSCode based, these fixes are an essential step regardless.

  • Updated to Monaco 0.47.0

  • Sticky lines support.

  • Enabled code mini-map only when hovered (right-side).

  • Set default font to Jetbrains Mono

  • Added button to switch to Minecraft Font (Monocraft)

Changes

  • Changed exporter udl2.1 to notepadplusplus for clarity.

  • Overhauled raw exporter to output JSON and much more information.

  • Added raw-min exporter, which is just the minimized version of raw.

Bugfixes

  • Made throw show source code rather than compiled code (including location).

  • MCCompiled now internally strips inline comments away to prevent unexpected errors.

  • Full-line comments still remain for uses like documentation; just inline comments are stripped.

  • Decimals multiplied using time suffixes are once again interpreted as integers (e.g., 0.5s)

  • playsound command no longer requires a selector, defaulting to @s if unspecified.

  • Fixed function re-definitions (e.g., partials or overloads) being interpreted as a call if there were parentheses.

  • (Web Editor) Autocomplete no longer triggers inside comments or strings.

  • (Web Editor) Unclosed strings are now highlighted.

  • All generated file names now use consistent camelCase formatting.

MCCompiled 1.17.1

  • Fixed new manifests not being created.

  • Fixed GitHub "wiki" URL not directing to the new wiki.

MCCompiled 1.17

Dialogue, more marketplace stuff, and loads of bugfixes.

Additions: Dialogue Support

  • dialogue new <name> { ... }

dialogue new "tradingDialogue" { name: "Trader" text: "Care to trade? I'm looking for only the finest pelts.\n§oHe squints at you." @@ -31,7 +31,7 @@ gold[@s] += 50 } } -
  • Supports code blocks and compiles right into the dialogue file.

  • dialogue open syntax and dialogue change like vanilla.

  • Includes compile-time selector validation.

  • Support for localization natively.

  • Support for using \n in text, if localization is enabled.

Additions

  • Added feature audiofiles which allows the playsound command to accept audio file inputs.

  • Location of audio file in relation to project has effect on where it's copied to the RP!

  • Audio file is placed in 'RP/sounds' root if no relative path is found.

  • Added proper function overloading.

  • Added partial functions, which when re-defined, are appended to rather than overwritten.

  • Added support for @r

  • Added errors for defining a function with the same parameters.

  • Added more compile-time checking to MANY commands/comparisons (especially regarding selectors).

  • Localization now lets the BP/RP use pack.name and pack.description

  • Updated documentation

Changes

  • Localization no longer applies to whitespace strings or strings without letters.

  • Removed support for @i selector, as it's not used in MCCompiled's dialogue implementation.

  • Changed syntax of fill to match vanilla, because wow, it was awful before.

  • Missing/unexpected parameters have more informative messages.

Bugfixes

  • Fixed a bug which prevented more than one function from being resolved in a single statement.

  • Fixed a bug which prevented more than one dereference from being resolved in a single statement (sometimes).

  • Builder fields on their own lines now have tokens properly processed.

  • $included files now execute relative to their location, not the caller's location.

  • Fixed an issue with dummy entities having incorrect tick_world component.

  • Updated the summon command (exploders and dummy entities) to work with the Minecraft 1.20.51+.

  • Declaring functions located in folders as auto now works as intended.

  • Removed actionbar times syntax because it's not a thing.

  • Code created by generative functions like round() is now properly omitted if used in unused code.

  • Code created by generative functions no longer generates more than once for the same configuration.

  • You can now escape definitions.def entries (e.g., \[color: red])

MCCompiled 1.16

Testing, compiler functions, and some heavily updated data-driving stuff!

Additions: Compiler/Runtime Functions

  • Added glyphE0(x, y = 0) function for getting a character on the E0 glyph at compile time.

  • Added glyphE1(x, y = 0) function for getting a character on the E1 glyph at compile time.

  • Added min(a, b) - takes lower of two values

  • Added max(a, b) - takes higher of two values

  • Added sqrt(n) - square root (no runtime yet)

  • Added sin(n) - sine (no runtime yet)

  • Added cos(n) - cosine (no runtime yet)

  • Added tan(n) - tangent (no runtime yet)

  • Added arctan(n) - angle which has a tangent of n (no runtime yet)

  • Added round(n) - rounds to nearest int

  • Added floor(n) - rounds down to nearest int

  • Added ceiling(n) - rounds up to nearest int

  • Added getValue(str) - gets a value with the given name; acts the same as a regular value.

Additions: Tests

  • Added tests feature, which enables tests. This is optional because it creates folders/files which would normally be unwanted.

  • Added test command which will create a test, similarly to how a function is defined.

  • Tests cannot be called, nor do they show up in the editor's autocomplete.

  • Tests are automatically ALL run sequentially in /function test.

  • Added assert, which checks the input condition and halts execution if it fails.

  • Added throw, which is same as a guaranteed assertion fail with a custom message.

Additions

  • Added $unique to reduce an array to its unique values. (a != b)

  • Added $assert, which will throw a compile-time error with extra info if its condition evaluates to false.

  • Added the ability to clarify variables using *, to select all registered score-holders. For example, setting the score of ALL players, including offline ones: score[*] = 0

  • Added feature autoinit which automatically calls init every time the project is compiled. :)

  • Added $append which appends items to the end of a preprocessor variable.

  • Added $prepend which prepends items to the start of a preprocessor variable.

  • Added dummy removeall syntax for removing all dummies (or filtered per-tag).

  • Documentation now resolves preprocessor variables.

  • Specifying a JSON array now works in directives that allow array inputs (e.g., $add, $sub).

  • Added compile-time function getValue(str) which returns a value that can be read/written to.

  • Added support to index preprocessor variables variableName[index].

Changes: $iterate Rework

Changes

  • You no longer have to specify decimal precision when using type inference with a decimal literal.

  • define now places its definition commands in the initialization file.

  • Feature uninstall now emits its function in the root directory instead of the ./compiler folder.

  • Operations $add $sub $mul $div $mod and $pow:

  • Operands (command inputs) now loop to fill the number of items in the given PPV.

  • Performing an int ? decimal operation no longer rounds the decimal, flooring instead.

  • Moved codebase over to use much more precise decimal type for more consistent use.

Bugfixes

  • Fixed /setblock invoking command(s) still using outdated block data format.

  • Fixed parameter-less macros sometimes breaking the web editor.

  • Fixed case where adding .0 to the end of a number didn't convert it to a decimal.

  • Fixed an issue where the initialization file would be emitted even if no commands were needed.

  • Fixed an error when using two or more features at once. (yeah, seriously)

  • give command no longer uses a structure when using properties which can be solved using JSON.

  • give command now consistently loads structures at the right place.

  • give command now generates stable structure names.

  • Added guard to prevent auto attribute from being added to functions with parameters.

  • Changed dummies feature to set dummy preprocessor variable on enable.

MCCompiled 1.15.1

  • Fixed Firefox support for web editor. Thanks cen0b

MCCompiled 1.15

Much better control flow and API support, along with loads of important bugfixes. No huge features in this update in preparation for all the new types stuff coming in 1.16. Types were completely reworked, so please report any bugs ASAP!

Additions

  • Optimized output by only including functions that were used in the project This allows users to use APIs created in MCCompiled in a more efficient way without bloating their project.

  • Web IDE: Macros now show up in autocomplete and fully support templating.

  • Added bind('query.is_sleeping') to possible bindings.

  • Returning inconsistent types in functions now uses conversion instead of throwing an error.

  • Reminder: the first instance of return always sets the function return type.

  • Swapping >< now converts types if they need to be converted.

  • Conversion now only respects the left-hand side of the operation. (thanks SuperFluffyGame!)

  • New export attribute which exports a function regardless if it's used or not.

  • New auto attribute which makes a function run every tick/interval (if specified).

  • Feature uninstall now also removes all temps and return values.

Changes

  • (last update) Value names are no longer hashed unless they are longer than 256 characters.

  • Function parameters are now global by default, making them work good when used with tick.json.

  • Return values are now global by default, making them work good when used with tick.json.

  • Removed unnecessary quotation marks in output to make Blockception happy (and me).

  • Swapped arguments of setblock command to match vanilla.

  • Much better handling of type-related errors.

  • Re-evaluated and re-implemented where and how temps are used. More will be used now, but there is less chance of temps overwriting each other when they shouldn't.

Bugfixes

  • Fixed --help formatting errors.

  • Daemon detects file changes and handles inputs faster.

  • 256 character limit for values now actually works.

  • Function parameters that exceed the character limit no longer have bugged names.

  • Function-call setup subfunctions no longer have . characters in their name.

  • Global text commands now properly display values local to the player they are displaying to. Consider the code define int score and globalactionbar "Your score is {score}". Previously, it would show all players the score of the player that executed the command. Now, it will show each individual player's score. This change only affects the globalX commands, not the regular ones in order to retain control with the programmer.

  • Language server now provides information about macros. This field was accidentally left empty.

  • Language server no longer crashes with big projects.

  • And has better overall support for browsers.

  • Added missing enchantments mending and swift_sneak

  • Fixed grammatical issues with decoration of if-statements.

  • OPEN COM.MOJANG button in the IDE works again.

MCCompiled 1.14

Dialectization, dynamism, and decoration! Oh, and a dump-truck of bugfixes.

Addition: Localization Support

  • New lang <locale> command for setting the active language.

  • All strings specified in FString fields will automatically be placed in the active lang file.

  • Translation components will automatically be used when an active language is set.

  • Added preprocessor variable (boolean) _lang_merge to determine whether to merge equal language keys.

Addition: Dynamic Calls

  • Functions can be defined using a string as the name of the function.

  • A function can be called dynamically by using the new $call <name> [parameters] directive.

  • Compiles to the exact same as calling a function regularly. i.e., name(parameters)

Additions

  • tp command now has full vanilla parity with facing support and checking for blocks.

  • Preprocessor variables can now be used in selectors. Note that the implementation used is identical to the way strings are, so the support is still shallow. No inline operations are run, only raw $dereferences are.

  • Massively better decoration (-dc compile option) to help people with reading/debugging output.

  • All subfunctions now contains detailed description of what it is doing and where it is invoked.

  • Unfortunately hits performance (even without decoration enabled), but only by a bit.

  • Makes following the code tree much easier.

  • No longer causes bugged code with multiline comments.

  • More consistent newlines added to better separate ideas.

  • Value and function documentation now shows up at the top of their respective locations.

  • Added DONT_DECORATE attribute to language.json to indicate directives should not be displayed.

  • Added DOCUMENTABLE attribute to language.json to indicate directives that can be documented.

  • Function folders can now be done by using dots. For example, math.abs will create abs under the math folder. This is a million times better than using a whole attribute just to set a folder. This also makes it so that your functions that are held behind a folder can be referenced using their fully qualified name rather than having many functions with the same name.

  • Added the extern attribute that can be added to functions that are already in the BP without changing their contents.

  • Added new support for project "properties" that allow you to change debug/decorate from the web editor. (gear icon)

  • Language server now closes existing files when a new client connects to it to prevent from accidentally overwriting it.

Changes

  • Renamed minecraftversion preprocessor variable to _minecraft for consistency with the others.

  • Renamed compilerversion preprocessor variable to _compiler for consistency with the others.

  • The syntax of if <selector> now only accepts @s selectors to dial in its meaning.

  • Removed the folder(...) attribute in respect for the much nicer period support.

  • The threshold for values to hash their names has been increased from 16 to 256 to fit the new 1.20 changes.

Bugfixes

  • Fixed incorrect behavior/resource dependencies, in some cases.

  • Prevented a crash if a manifest data module did not contain a description.

  • Fixed if not <boolean> pattern throwing an error.

  • Fixed loaded (existing) manifest files not having a proper output location.

  • Fixed an issue that prevented Decoration from being enabled on the server.

  • Save/load dialog boxes now always open on top of the IDE window. (WOO!)

  • Comments no longer trip up if/else statements. This was meant to be fixed in 1.12, but it still failed when no brackets were used.

  • Return statements now properly terminate single line if/else statements.

  • Disabled buttons in the Web IDE no longer change the cursor.

MCCompiled 1.13

MoLang binding, bugfixes, and new IDE features!

Changes

  • BREAKING: When using development folders, MCC now names folders like so: name_BP and name_RP.

  • Removed size limit on scatter command, replaced with a warning.

  • Scatter command now runs "shallowly" when linting, so it doesn't impact performance.

  • Variable definitions now allow attributes before and after the name.

  • Function definitions now allow attributes before and after the name.

Additions

  • New attribute bind(query) that will bind a MoLang query to a value. Limited support. See language.json > bindings for all of the current bindings.

  • Including a comment behind a function definition will now count as documentation.

  • Including a comment behind a value definition will now count as documentation.

  • Including a comment behind a macro definition will now count as documentation.

  • Documentation for all objects now show up in the IDE.

  • Introduced server spec 5.7 with symbol documentation and version information.

Bugfixes

  • Fixed attribute functions sometimes being broken and causing weird behavior.

  • Fixed slight issue with terminal coloring.

  • Scatter command works again.

  • Fixed the encoding issues with definitions.def.

MCCompiled 1.12

Bugfixes, bugfixes, bugfixes + internal comparison overhaul!

Bugfixes

  • Reverted a small linting optimization that caused it to fail silently sometimes.

  • Fixed an issue when trying to compare using aliased values (parameters or names longer than 16 chars)

  • Fixed some comparison subcommands not properly sending out subcommands.

  • if with compile-time comparisons now works when a single statement is given.

  • if/else statements now tolerate having comments between them and their attached code.

Comparison Bugfix

Comparisons using if/else statements now properly stores the result of the first evaluation, meaning that the if clause and else clause cannot both be triggered if the parameters of the condition changes. The following code block had the following behavior in prior versions:

+
  • Supports code blocks and compiles right into the dialogue file.

  • dialogue open syntax and dialogue change like vanilla.

  • Includes compile-time selector validation.

  • Support for localization natively.

  • Support for using \n in text, if localization is enabled.

Additions

  • Added feature audiofiles which allows the playsound command to accept audio file inputs.

  • Location of audio file in relation to project has effect on where it's copied to the RP!

  • Audio file is placed in 'RP/sounds' root if no relative path is found.

  • Added proper function overloading.

  • Added partial functions, which when re-defined, are appended to rather than overwritten.

  • Added support for @r

  • Added errors for defining a function with the same parameters.

  • Added more compile-time checking to MANY commands/comparisons (especially regarding selectors).

  • Localization now lets the BP/RP use pack.name and pack.description

  • Updated documentation

Changes

  • Localization no longer applies to whitespace strings or strings without letters.

  • Removed support for @i selector, as it's not used in MCCompiled's dialogue implementation.

  • Changed syntax of fill to match vanilla, because wow, it was awful before.

  • Missing/unexpected parameters have more informative messages.

Bugfixes

  • Fixed a bug which prevented more than one function from being resolved in a single statement.

  • Fixed a bug which prevented more than one dereference from being resolved in a single statement (sometimes).

  • Builder fields on their own lines now have tokens properly processed.

  • $included files now execute relative to their location, not the caller's location.

  • Fixed an issue with dummy entities having incorrect tick_world component.

  • Updated the summon command (exploders and dummy entities) to work with the Minecraft 1.20.51+.

  • Declaring functions located in folders as auto now works as intended.

  • Removed actionbar times syntax because it's not a thing.

  • Code created by generative functions like round() is now properly omitted if used in unused code.

  • Code created by generative functions no longer generates more than once for the same configuration.

  • You can now escape definitions.def entries (e.g., \[color: red])

MCCompiled 1.16

Testing, compiler functions, and some heavily updated data-driving stuff!

Additions: Compiler/Runtime Functions

  • Added glyphE0(x, y = 0) function for getting a character on the E0 glyph at compile time.

  • Added glyphE1(x, y = 0) function for getting a character on the E1 glyph at compile time.

  • Added min(a, b) - takes lower of two values

  • Added max(a, b) - takes higher of two values

  • Added sqrt(n) - square root (no runtime yet)

  • Added sin(n) - sine (no runtime yet)

  • Added cos(n) - cosine (no runtime yet)

  • Added tan(n) - tangent (no runtime yet)

  • Added arctan(n) - angle which has a tangent of n (no runtime yet)

  • Added round(n) - rounds to nearest int

  • Added floor(n) - rounds down to nearest int

  • Added ceiling(n) - rounds up to nearest int

  • Added getValue(str) - gets a value with the given name; acts the same as a regular value.

Additions: Tests

  • Added tests feature, which enables tests. This is optional because it creates folders/files which would normally be unwanted.

  • Added test command which will create a test, similarly to how a function is defined.

  • Tests cannot be called, nor do they show up in the editor's autocomplete.

  • Tests are automatically ALL run sequentially in /function test.

  • Added assert, which checks the input condition and halts execution if it fails.

  • Added throw, which is same as a guaranteed assertion fail with a custom message.

Additions

  • Added $unique to reduce an array to its unique values. (a != b)

  • Added $assert, which will throw a compile-time error with extra info if its condition evaluates to false.

  • Added the ability to clarify variables using *, to select all registered score-holders. For example, setting the score of ALL players, including offline ones: score[*] = 0

  • Added feature autoinit which automatically calls init every time the project is compiled. :)

  • Added $append which appends items to the end of a preprocessor variable.

  • Added $prepend which prepends items to the start of a preprocessor variable.

  • Added dummy removeall syntax for removing all dummies (or filtered per-tag).

  • Documentation now resolves preprocessor variables.

  • Specifying a JSON array now works in directives that allow array inputs (e.g., $add, $sub).

  • Added compile-time function getValue(str) which returns a value that can be read/written to.

  • Added support to index preprocessor variables variableName[index].

Changes: $iterate Rework

Changes

  • You no longer have to specify decimal precision when using type inference with a decimal literal.

  • define now places its definition commands in the initialization file.

  • Feature uninstall now emits its function in the root directory instead of the ./compiler folder.

  • Operations $add $sub $mul $div $mod and $pow:

  • Operands (command inputs) now loop to fill the number of items in the given PPV.

  • Performing an int ? decimal operation no longer rounds the decimal, flooring instead.

  • Moved codebase over to use much more precise decimal type for more consistent use.

Bugfixes

  • Fixed /setblock invoking command(s) still using outdated block data format.

  • Fixed parameter-less macros sometimes breaking the web editor.

  • Fixed case where adding .0 to the end of a number didn't convert it to a decimal.

  • Fixed an issue where the initialization file would be emitted even if no commands were needed.

  • Fixed an error when using two or more features at once. (yeah, seriously)

  • give command no longer uses a structure when using properties which can be solved using JSON.

  • give command now consistently loads structures at the right place.

  • give command now generates stable structure names.

  • Added guard to prevent auto attribute from being added to functions with parameters.

  • Changed dummies feature to set dummy preprocessor variable on enable.

MCCompiled 1.15.1

  • Fixed Firefox support for web editor. Thanks cen0b

MCCompiled 1.15

Much better control flow and API support, along with loads of important bugfixes. No huge features in this update in preparation for all the new types stuff coming in 1.16. Types were completely reworked, so please report any bugs ASAP!

Additions

  • Optimized output by only including functions that were used in the project This allows users to use APIs created in MCCompiled in a more efficient way without bloating their project.

  • Web IDE: Macros now show up in autocomplete and fully support templating.

  • Added bind('query.is_sleeping') to possible bindings.

  • Returning inconsistent types in functions now uses conversion instead of throwing an error.

  • Reminder: the first instance of return always sets the function return type.

  • Swapping >< now converts types if they need to be converted.

  • Conversion now only respects the left-hand side of the operation. (thanks SuperFluffyGame!)

  • New export attribute which exports a function regardless if it's used or not.

  • New auto attribute which makes a function run every tick/interval (if specified).

  • Feature uninstall now also removes all temps and return values.

Changes

  • (last update) Value names are no longer hashed unless they are longer than 256 characters.

  • Function parameters are now global by default, making them work good when used with tick.json.

  • Return values are now global by default, making them work good when used with tick.json.

  • Removed unnecessary quotation marks in output to make Blockception happy (and me).

  • Swapped arguments of setblock command to match vanilla.

  • Much better handling of type-related errors.

  • Re-evaluated and re-implemented where and how temps are used. More will be used now, but there is less chance of temps overwriting each other when they shouldn't.

Bugfixes

  • Fixed --help formatting errors.

  • Daemon detects file changes and handles inputs faster.

  • 256 character limit for values now actually works.

  • Function parameters that exceed the character limit no longer have bugged names.

  • Function-call setup subfunctions no longer have . characters in their name.

  • Global text commands now properly display values local to the player they are displaying to. Consider the code define int score and globalactionbar "Your score is {score}". Previously, it would show all players the score of the player that executed the command. Now, it will show each individual player's score. This change only affects the globalX commands, not the regular ones in order to retain control with the programmer.

  • Language server now provides information about macros. This field was accidentally left empty.

  • Language server no longer crashes with big projects.

  • And has better overall support for browsers.

  • Added missing enchantments mending and swift_sneak

  • Fixed grammatical issues with decoration of if-statements.

  • OPEN COM.MOJANG button in the IDE works again.

MCCompiled 1.14

Dialectization, dynamism, and decoration! Oh, and a dump-truck of bugfixes.

Addition: Localization Support

  • New lang <locale> command for setting the active language.

  • All strings specified in FString fields will automatically be placed in the active lang file.

  • Translation components will automatically be used when an active language is set.

  • Added preprocessor variable (boolean) _lang_merge to determine whether to merge equal language keys.

Addition: Dynamic Calls

  • Functions can be defined using a string as the name of the function.

  • A function can be called dynamically by using the new $call <name> [parameters] directive.

  • Compiles to the exact same as calling a function regularly. i.e., name(parameters)

Additions

  • tp command now has full vanilla parity with facing support and checking for blocks.

  • Preprocessor variables can now be used in selectors. Note that the implementation used is identical to the way strings are, so the support is still shallow. No inline operations are run, only raw $dereferences are.

  • Massively better decoration (-dc compile option) to help people with reading/debugging output.

  • All subfunctions now contains detailed description of what it is doing and where it is invoked.

  • Unfortunately hits performance (even without decoration enabled), but only by a bit.

  • Makes following the code tree much easier.

  • No longer causes bugged code with multiline comments.

  • More consistent newlines added to better separate ideas.

  • Value and function documentation now shows up at the top of their respective locations.

  • Added DONT_DECORATE attribute to language.json to indicate directives should not be displayed.

  • Added DOCUMENTABLE attribute to language.json to indicate directives that can be documented.

  • Function folders can now be done by using dots. For example, math.abs will create abs under the math folder. This is a million times better than using a whole attribute just to set a folder. This also makes it so that your functions that are held behind a folder can be referenced using their fully qualified name rather than having many functions with the same name.

  • Added the extern attribute that can be added to functions that are already in the BP without changing their contents.

  • Added new support for project "properties" that allow you to change debug/decorate from the web editor. (gear icon)

  • Language server now closes existing files when a new client connects to it to prevent from accidentally overwriting it.

Changes

  • Renamed minecraftversion preprocessor variable to _minecraft for consistency with the others.

  • Renamed compilerversion preprocessor variable to _compiler for consistency with the others.

  • The syntax of if <selector> now only accepts @s selectors to dial in its meaning.

  • Removed the folder(...) attribute in respect for the much nicer period support.

  • The threshold for values to hash their names has been increased from 16 to 256 to fit the new 1.20 changes.

Bugfixes

  • Fixed incorrect behavior/resource dependencies, in some cases.

  • Prevented a crash if a manifest data module did not contain a description.

  • Fixed if not <boolean> pattern throwing an error.

  • Fixed loaded (existing) manifest files not having a proper output location.

  • Fixed an issue that prevented Decoration from being enabled on the server.

  • Save/load dialog boxes now always open on top of the IDE window. (WOO!)

  • Comments no longer trip up if/else statements. This was meant to be fixed in 1.12, but it still failed when no brackets were used.

  • Return statements now properly terminate single line if/else statements.

  • Disabled buttons in the Web IDE no longer change the cursor.

MCCompiled 1.13

MoLang binding, bugfixes, and new IDE features!

Changes

  • BREAKING: When using development folders, MCC now names folders like so: name_BP and name_RP.

  • Removed size limit on scatter command, replaced with a warning.

  • Scatter command now runs "shallowly" when linting, so it doesn't impact performance.

  • Variable definitions now allow attributes before and after the name.

  • Function definitions now allow attributes before and after the name.

Additions

  • New attribute bind(query) that will bind a MoLang query to a value. Limited support. See language.json > bindings for all of the current bindings.

  • Including a comment behind a function definition will now count as documentation.

  • Including a comment behind a value definition will now count as documentation.

  • Including a comment behind a macro definition will now count as documentation.

  • Documentation for all objects now show up in the IDE.

  • Introduced server spec 5.7 with symbol documentation and version information.

Bugfixes

  • Fixed attribute functions sometimes being broken and causing weird behavior.

  • Fixed slight issue with terminal coloring.

  • Scatter command works again.

  • Fixed the encoding issues with definitions.def.

MCCompiled 1.12

Bugfixes, bugfixes, bugfixes + internal comparison overhaul!

Bugfixes

  • Reverted a small linting optimization that caused it to fail silently sometimes.

  • Fixed an issue when trying to compare using aliased values (parameters or names longer than 16 chars)

  • Fixed some comparison subcommands not properly sending out subcommands.

  • if with compile-time comparisons now works when a single statement is given.

  • if/else statements now tolerate having comments between them and their attached code.

Comparison Bugfix

Comparisons using if/else statements now properly stores the result of the first evaluation, meaning that the if clause and else clause cannot both be triggered if the parameters of the condition changes. The following code block had the following behavior in prior versions:

define int number = 105 if number > 100 { @@ -43,4 +43,4 @@
Number was greater than the maximum bound. Number was in bounds. -

This has been fixed for all versions 1.12+ as it now reuses the result of the first evaluation. Bugs may happen as a result of this change, but ultimately it is the direction I want to go for future code flow implementations (while loops, async file splitting, etc..)

MCCompiled 1.11

Just a small set of hotfixes today with customizable time formatting and new internal features.

Additions

  • Added the _timeformat preprocessor variable that indicates how times should be formatted. The default is "m:ss". Valid letters include h, m, and s. The number of single characters indicate the minimum number of digits (padded with 0's if not filled).

  • Added _realtime preprocessor variable, a string that shows the real-life time of compilation.

  • Added _realdate preprocessor variable, a string that shows the real-life date of compilation.

  • Introduced a warning when defining preprocessor variables starting with underscores.

  • Added command categorization in language.json.

  • Added new exporter mc-compiled --syntax markdown for the new cheat sheet on the wiki.

Bugfixes

  • Fixed FStrings not working with global time variables.

  • Setting a precision on decimals works again. It was defaulting to 2.

  • Fixed bug causing globalprint, globalactionbar, and globaltitle to parse incorrectly.

  • Fixed "exploders" feature being the wrong name.

  • Users can no longer write feature no_features, resulting in a crash (?)

MCCompiled 1.1

Note that this is an update with MULTIPLE BREAKING CHANGES. I reconsidered a lot of parts of the language's design and landed on a result which better fits genuine use of the language. There is also a lot of new functionality for things I was really dreading doing and resorted previously to lazy implementations, such as a lack of indexing.

Changes

  • New branding!

  • Improved performance in some areas, hit it in some other areas. All in the name of features.

  • Definitions updated for 1.19.70, and potions have been completed.

  • Much more informative pattern-mismatch errors. (missing arguments, wrong arguments, etc.)

  • Commas are now completely ignored by the tokenizer, so they can be used to visually separate whatever you please.

  • Heavy linting optimizations.

  • Improved error handling with brackets.

  • The $log command now accepts any input, including multiple arguments.

  • Improved performance with strings utilizing preprocessor variables.

  • Symbol & changed to keyword and to be more consistent with the rest of the language.

  • Remove processing of multiple directives on the same line. This was dumb.

  • place command changed to setblock to remove collisions with if block.

  • tag single works with much full consistency now.

  • Places generated structures in their own folder. (give and scatter commands)

  • Swapped arguments around to match $var in the following directives:

    • $len

    • $sum

    • $median

    • $mean

    • $strlower

    • $strupper

    • $strfriendly

  • "null" entities and their commands have been renamed to dummy. This was done to make way for the new null literal.

  • Structs were removed since they served no real purpose yet.

  • Implicit conversions (compiler-side) from decimal to int now floors instead of rounds for consistency.

  • Removed dummy classes in favor of simply giving an option to tag them on spawn. New syntax:

  • dummy create <name> [tag]

  • dummy single <name> [tag]

  • dummy remove <name> [tag]

Additions

  • @initiator is now supported, @i for shorthand.

  • Web IDE: Font can now be resized with Ctrl + Zoom

  • New uninstall feature which creates a function to remove all this project's scoreboards/tags from the world.

  • New --maxdepth command-line argument. Sets max allocated depth.

  • New --version command-line argument. Prints out compiler version.

  • New --variable command-line argument. Sets starting preprocessor variable.

  • Completely new and improved if-statement format. See bottom of changelog for more information.

  • Now properly sets up dependencies with manifest generation, additionally pulling UUIDs from existing manifests.

  • Preprocessor variables now support storing range values.

  • $len now accepts strings, returning the proper length.

  • New null keyword which represents 0 under any type. Now the default return value for functions.

  • All declaration statements (define, function parameters, etc.) now use type inference if no type is specified.

  • FString "expressions" now fully parse and evaluate the code inside them.

  • Strings can be declared using double or single quotes now, and they will only be closed by the same character.

  • $repeat now accepts range values (inclusive).

  • $strfriendly, $strupper, and $strlower now treat a single parameter as both input and output.

  • Added a unit test library for testing every language feature. This should help catch bugs before release builds.

  • Added $sort which sorts the values in a preprocessor variable either ascending or descending.

  • Added $reverse which reverses the order of the values in a preprocessor variable.

  • Added aliases to certain commands.

Bugfixes

  • Re-added enchantments to definitions.def... oops.

  • Range literals now correct themselves if min > max.

  • Tokenizer now distinguishes between a negative relative coordinate and subtracting a value.

  • Error output is now sent to standard error output, like it's supposed to. This should fix regolith's formatting as a result.

  • Tokenizer no longer implodes when an @ is followed by the end of the file.

  • $repeat can no longer repeat non-runnable statements like blocks/comments (standalone).

  • Rotation comparisons no longer overlap each other.

  • Only boolean values can be used in if x {} format.

  • Fixed damage command not working when damage type was specified.

  • Compile time measurements no longer include file read/write times.

  • Decimal number interoperation now properly converts precision for all operations.

  • Always converts to the left-hand side's precision in the operation.

  • Compiler now gives a proper error when dereferencing a PPV that doesn't exist.

  • Fixed a catastrophic issue when comparing a "constant and value" in that order.

  • Two functions with shared parameter names will no longer cause issues. Now uses aliases/hashing.

  • Macros now throw exceptions at both their source location and the caller location.

Web IDE

  • Rewrote language server from the ground up and included complete documentation (now v5.6). Now uses a WebSocket implementation for communication with the language server rather than HTTP. Accessible by third-party apps, and documentation will remain consistent across versions. We gain a lot of context-independent control with this new method... and better data transport overall.

  • No longer errors when trying to display a fatal exception.

  • Saving/loading projects has moved entirely to the server side, meaning all browsers are now supported.

  • Now sets working directory to the file which is loaded/saved to, meaning 'includes' and 'JSON files' are usable.

  • Added a new "extras" button with many new actions and links.

  • Top-bar buttons are more consistent, and better reflect the state of the editor.

  • Dimmed full-screen alerts to see better over any code, and made animations much more responsive.

  • Much snappier autocomplete results.

  • Debug improvements.

  • Compiler-defined functions are now correctly identified in the symbol description.

  • Implemented dynamic project metadata. Project name is now independent of file name. This is just the first of many steps which will improve the IDE-server experience. Metadata is stored in the source file, but is handled entirely by the server so it doesn't have to be seen by the user.

New IF

If statements were completely reworked as they felt disconnected from the rest of the language. If-statements still support and and not keywords.

Additionally, the new if-statements now leverage the new execute format introduced in 1.19, meaning that they now work like actual if statements rather than glorified selectors. This comes with a massive runtime performance boost!

The new commands are as follows and are documented online:

  • Same scoreboard comparisons stuff. if <boolean> - checks if Boolean is true (or false if not was specified.) if <score> <operator> <value> - checks a value.

  • Different comparison method more focused on the dominant type, selectors. if <@selector> - filters entities if count <@selector> <operator> <value> - checks selector match count if any <@selector> - checks selector for any matches if block <x> <y> <z> <block> [data] - checks for block

Indexing and Clarifiers

  • Added indexing/clarifier operator [value] that can be used on various things.

  • Indexing can access a component/item from an iterable value:

  • $get x n has been removed in respect for the new x[n] syntax.

  • Indexing a string will return a single character.

  • Indexing a range can return the 0th/1st element from it.

  • Clarifying is used with values to "clarify" the target.

  • Values default to @s (executing entity)

  • Values can be clarified to change who they point to. This is intended to be a good solution to cross-entity interaction. Using clarifiers, you can perform operations between entities rather than being forced to work on the executing entity. Example: points = points[@e[type=cow,c=1]] sets @s's points to the points of the nearest cow. total[@p] += total adds @s's total to the nearest player's total.

JSON Improvements

Hopefully these changes can make using JSON with MCCompiled much more accessible for actual code examples. Indexing JSON should feel much more like an actual language.

  • JSON values can be indexed using [n] and [string] now.

  • $json still works as before, but can now load partial/incomplete values. If you want, you can just load the root of the JSON and use indexing to do all the work!

  • $json has some more lenient syntax now. Notice that 'path' is now optional.

  • $json <string: file> <id: result> [string: path]

  • $json <json: json> <id: result> [string: path]

  • $iterate now works on JSON arrays.

  • $len now can get the length of a JSON array.

MCCompiled 1.04

Changes

  • Builder fields can now be placed on proceeding lines after a statement.

  • If a debugger is running, handled exceptions will pass-through to allow easier debugging.

Additions

  • Detailed descriptions and a bunch of extra info in language.json.

  • Syntax has been officially "documented" and is now able to be exported to three unique language targets using mc-compiled --syntax.

  • Added an explode command with a new entity generator.

  • Requires exploder feature to be enabled.

  • Added clear command.

  • Added effect and effecth command for shown/hidden particles.

  • Capability of launching MCCompiled as a compiler/linting server which sends over code information.

  • Created protocol for launching an MCCompiled server through URL: mccompiled://server

Additions: Web IDE

https://7ukecreat0r.github.io/mccompiled/editor.html Initial release of the completely client-sided web IDE!

  • Get live code errors as you type.

  • Autocompletion for all language keywords.

  • Autocompletion and details for variables/functions.

  • Compile straight into development folders with the click of a button.

  • Easy saving/loading of files, as well as project naming.

Bugfixes

  • Mistyped function names now have proper error messages.

  • Fixed issue with if-statement commands not aligning to selected properly.

  • Proper errors when if-statement (selector transformer) is given invalid option.

  • Statements requiring following statements/blocks no longer throw unhandled exceptions.

  • Parenthetical (squashable) statements being $repeated no longer causes unexpected errors.

MCCompiled 1.03

Most of the features here are changes I wished existed when I was working on a larger project. I also hit a couple items off my bucket list and patched some important bugs. I planned for this update to be a hotfix, but uh... you see how that turned out

Changes

  • Null command no longer has rotation parameters since it caused unexpected behavior.

  • Changed null subcommands:

  • null create <string: name> [string: class] [pos: x, y, z]

  • null single <string: name> [string: class] [pos: x, y, z]

  • null remove

  • null remove [name] [class]

  • null class <class>

  • null class remove

  • Changed compiler-generated functions folder name to "compiler" for clarity.

  • count and level if-statement conditions use proper comparison arguments now. (\<, \>\=, \=\=, etc..)

Additions

  • Nulls can now have "classes" which behave similar to tags.

  • Added new if-statement clauses:

  • if null - filter for all null entities

  • if null [name] - filter for all null entities with a certain name.

  • if class <class> - filter for all null entities with a certain class.

  • if position <x|y|z> <operator> <number> - compare position

  • if position <x> <y> <z> - check position These can be placed in tandem to select any combination of nulls.

  • Added -ppv compiler option to set variables from command line.

  • Added new command for which acts as a way of natively executing over entities.

  • Made position, rotation, count, and level if-statements use proper comparison arguments. It just feels SO much better.

Bugfixes

  • Stop normal null creation from behaving like a singleton.

  • Made selector offsets work more consistently outside if-statements.

  • Fixed if-statements where relative coordinates were being aligned to individual entity rather than the executing one.

  • If root file is empty, it will now contain project info to prevent MC compile errors.

MCCompiled 1.02

Changes

  • The damage command now additionally accepts three coordinates for the attacker parameter

  • Selectors can now be specified as strings in the new formats outlined on the cheat sheet.

  • Strings that are in selector format (e.g., "@e[name=Bogey]") will now be parsed during conversion to selector.

  • Language commands (directives) are now held in a JSON file and parsed on startup.

  • Changed how 'blocks' operate internally for better stability in the future.

  • Enum parser was improved and holds more information.

  • Integers using time notation (32m, 5s, etc...) now cache to ensure accurate scaling across commands.

  • Removed pattern validation for if-statements.

  • Internally reworked if-statements and made its processing system modular and portable.

  • Moved "if limit..." to its own "limit" command since it didn't make a whole lot of sense.

Additions

  • New "null" command for creating/removing dummy entities.

  • if any ... will check if any entities match a selector.

  • if count ... will check if the number of entities a selector matches is in a range.

  • Managed entity names can now be used in select.

  • You can now use multiline comments with \/* and *\/

  • Range arguments such as 5.., 1..100, !..6, etc. are now parsed and proper language objects.

  • Book content and leather armor support for give command.

  • New "tag" command for interacting with entity tags.

  • hasitem= is now parsed in selectors.

  • if item and if holding for hasitem interaction.

  • Following select ... by a block will push/pop the selector.

Bugfixes

  • When else statements throw, they will show the correct source location.

  • Commands no longer override internal enum values.

  • Enum parser now accepts values using periods.

  • Fixed an issue where selectors were sometimes improperly merged if a manual selection was performed.

  • Limit now actually works when custom selectors are specified.

MCCompiled 1.01

Changes

  • Removed the --basic compile option.

  • Reworked file system from the ground up--mostly internal changes.

  • Regolith filter support

  • Parentheses now affect squashing order (conforming to PEMDAS).

Features

  • Added offset identifier in if-statements to allow execute offsets.

  • Added --search, searches subfolders and compiles all .mcc files.

  • Added --outputbp, sets behavior pack output folder.

  • Added --outputrp, sets resource pack output folder.

  • Added --outputdevelopment, outputs to com.mojang.

  • Added $iterate which acts as a preprocessor for-loop. Allows for better JSON support.

  • Functions can now have default selectors.

  • init now can take multiple variable inputs.

Bugfixes

  • Fixed small issue with fstrings unnecessarily aligning when they shouldn't.

  • No longer generates resource pack unless necessary.

  • Passing preprocessor variables (still denoted with $) into macro calls will now properly transfer array values.

  • Fixed misalignment with stacked inline function calls.

MCCompiled 1.0

  • Initial release

Last modified: 24 April 2024
\ No newline at end of file +

This has been fixed for all versions 1.12+ as it now reuses the result of the first evaluation. Bugs may happen as a result of this change, but ultimately it is the direction I want to go for future code flow implementations (while loops, async file splitting, etc..)

MCCompiled 1.11

Just a small set of hotfixes today with customizable time formatting and new internal features.

Additions

  • Added the _timeformat preprocessor variable that indicates how times should be formatted. The default is "m:ss". Valid letters include h, m, and s. The number of single characters indicate the minimum number of digits (padded with 0's if not filled).

  • Added _realtime preprocessor variable, a string that shows the real-life time of compilation.

  • Added _realdate preprocessor variable, a string that shows the real-life date of compilation.

  • Introduced a warning when defining preprocessor variables starting with underscores.

  • Added command categorization in language.json.

  • Added new exporter mc-compiled --syntax markdown for the new cheat sheet on the wiki.

Bugfixes

  • Fixed FStrings not working with global time variables.

  • Setting a precision on decimals works again. It was defaulting to 2.

  • Fixed bug causing globalprint, globalactionbar, and globaltitle to parse incorrectly.

  • Fixed "exploders" feature being the wrong name.

  • Users can no longer write feature no_features, resulting in a crash (?)

MCCompiled 1.1

Note that this is an update with MULTIPLE BREAKING CHANGES. I reconsidered a lot of parts of the language's design and landed on a result which better fits genuine use of the language. There is also a lot of new functionality for things I was really dreading doing and resorted previously to lazy implementations, such as a lack of indexing.

Changes

  • New branding!

  • Improved performance in some areas, hit it in some other areas. All in the name of features.

  • Definitions updated for 1.19.70, and potions have been completed.

  • Much more informative pattern-mismatch errors. (missing arguments, wrong arguments, etc.)

  • Commas are now completely ignored by the tokenizer, so they can be used to visually separate whatever you please.

  • Heavy linting optimizations.

  • Improved error handling with brackets.

  • The $log command now accepts any input, including multiple arguments.

  • Improved performance with strings utilizing preprocessor variables.

  • Symbol & changed to keyword and to be more consistent with the rest of the language.

  • Remove processing of multiple directives on the same line. This was dumb.

  • place command changed to setblock to remove collisions with if block.

  • tag single works with much full consistency now.

  • Places generated structures in their own folder. (give and scatter commands)

  • Swapped arguments around to match $var in the following directives:

    • $len

    • $sum

    • $median

    • $mean

    • $strlower

    • $strupper

    • $strfriendly

  • "null" entities and their commands have been renamed to dummy. This was done to make way for the new null literal.

  • Structs were removed since they served no real purpose yet.

  • Implicit conversions (compiler-side) from decimal to int now floors instead of rounds for consistency.

  • Removed dummy classes in favor of simply giving an option to tag them on spawn. New syntax:

  • dummy create <name> [tag]

  • dummy single <name> [tag]

  • dummy remove <name> [tag]

Additions

  • @initiator is now supported, @i for shorthand.

  • Web IDE: Font can now be resized with Ctrl + Zoom

  • New uninstall feature which creates a function to remove all this project's scoreboards/tags from the world.

  • New --maxdepth command-line argument. Sets max allocated depth.

  • New --version command-line argument. Prints out compiler version.

  • New --variable command-line argument. Sets starting preprocessor variable.

  • Completely new and improved if-statement format. See bottom of changelog for more information.

  • Now properly sets up dependencies with manifest generation, additionally pulling UUIDs from existing manifests.

  • Preprocessor variables now support storing range values.

  • $len now accepts strings, returning the proper length.

  • New null keyword which represents 0 under any type. Now the default return value for functions.

  • All declaration statements (define, function parameters, etc.) now use type inference if no type is specified.

  • FString "expressions" now fully parse and evaluate the code inside them.

  • Strings can be declared using double or single quotes now, and they will only be closed by the same character.

  • $repeat now accepts range values (inclusive).

  • $strfriendly, $strupper, and $strlower now treat a single parameter as both input and output.

  • Added a unit test library for testing every language feature. This should help catch bugs before release builds.

  • Added $sort which sorts the values in a preprocessor variable either ascending or descending.

  • Added $reverse which reverses the order of the values in a preprocessor variable.

  • Added aliases to certain commands.

Bugfixes

  • Re-added enchantments to definitions.def... oops.

  • Range literals now correct themselves if min > max.

  • Tokenizer now distinguishes between a negative relative coordinate and subtracting a value.

  • Error output is now sent to standard error output, like it's supposed to. This should fix regolith's formatting as a result.

  • Tokenizer no longer implodes when an @ is followed by the end of the file.

  • $repeat can no longer repeat non-runnable statements like blocks/comments (standalone).

  • Rotation comparisons no longer overlap each other.

  • Only boolean values can be used in if x {} format.

  • Fixed damage command not working when damage type was specified.

  • Compile time measurements no longer include file read/write times.

  • Decimal number interoperation now properly converts precision for all operations.

  • Always converts to the left-hand side's precision in the operation.

  • Compiler now gives a proper error when dereferencing a PPV that doesn't exist.

  • Fixed a catastrophic issue when comparing a "constant and value" in that order.

  • Two functions with shared parameter names will no longer cause issues. Now uses aliases/hashing.

  • Macros now throw exceptions at both their source location and the caller location.

Web IDE

  • Rewrote language server from the ground up and included complete documentation (now v5.6). Now uses a WebSocket implementation for communication with the language server rather than HTTP. Accessible by third-party apps, and documentation will remain consistent across versions. We gain a lot of context-independent control with this new method... and better data transport overall.

  • No longer errors when trying to display a fatal exception.

  • Saving/loading projects has moved entirely to the server side, meaning all browsers are now supported.

  • Now sets working directory to the file which is loaded/saved to, meaning 'includes' and 'JSON files' are usable.

  • Added a new "extras" button with many new actions and links.

  • Top-bar buttons are more consistent, and better reflect the state of the editor.

  • Dimmed full-screen alerts to see better over any code, and made animations much more responsive.

  • Much snappier autocomplete results.

  • Debug improvements.

  • Compiler-defined functions are now correctly identified in the symbol description.

  • Implemented dynamic project metadata. Project name is now independent of file name. This is just the first of many steps which will improve the IDE-server experience. Metadata is stored in the source file, but is handled entirely by the server so it doesn't have to be seen by the user.

New IF

If statements were completely reworked as they felt disconnected from the rest of the language. If-statements still support and and not keywords.

Additionally, the new if-statements now leverage the new execute format introduced in 1.19, meaning that they now work like actual if statements rather than glorified selectors. This comes with a massive runtime performance boost!

The new commands are as follows and are documented online:

  • Same scoreboard comparisons stuff. if <boolean> - checks if Boolean is true (or false if not was specified.) if <score> <operator> <value> - checks a value.

  • Different comparison method more focused on the dominant type, selectors. if <@selector> - filters entities if count <@selector> <operator> <value> - checks selector match count if any <@selector> - checks selector for any matches if block <x> <y> <z> <block> [data] - checks for block

Indexing and Clarifiers

  • Added indexing/clarifier operator [value] that can be used on various things.

  • Indexing can access a component/item from an iterable value:

  • $get x n has been removed in respect for the new x[n] syntax.

  • Indexing a string will return a single character.

  • Indexing a range can return the 0th/1st element from it.

  • Clarifying is used with values to "clarify" the target.

  • Values default to @s (executing entity)

  • Values can be clarified to change who they point to. This is intended to be a good solution to cross-entity interaction. Using clarifiers, you can perform operations between entities rather than being forced to work on the executing entity. Example: points = points[@e[type=cow,c=1]] sets @s's points to the points of the nearest cow. total[@p] += total adds @s's total to the nearest player's total.

JSON Improvements

Hopefully these changes can make using JSON with MCCompiled much more accessible for actual code examples. Indexing JSON should feel much more like an actual language.

  • JSON values can be indexed using [n] and [string] now.

  • $json still works as before, but can now load partial/incomplete values. If you want, you can just load the root of the JSON and use indexing to do all the work!

  • $json has some more lenient syntax now. Notice that 'path' is now optional.

  • $json <string: file> <id: result> [string: path]

  • $json <json: json> <id: result> [string: path]

  • $iterate now works on JSON arrays.

  • $len now can get the length of a JSON array.

MCCompiled 1.04

Changes

  • Builder fields can now be placed on proceeding lines after a statement.

  • If a debugger is running, handled exceptions will pass-through to allow easier debugging.

Additions

  • Detailed descriptions and a bunch of extra info in language.json.

  • Syntax has been officially "documented" and is now able to be exported to three unique language targets using mc-compiled --syntax.

  • Added an explode command with a new entity generator.

  • Requires exploder feature to be enabled.

  • Added clear command.

  • Added effect and effecth command for shown/hidden particles.

  • Capability of launching MCCompiled as a compiler/linting server which sends over code information.

  • Created protocol for launching an MCCompiled server through URL: mccompiled://server

Additions: Web IDE

https://7ukecreat0r.github.io/mccompiled/editor.html Initial release of the completely client-sided web IDE!

  • Get live code errors as you type.

  • Autocompletion for all language keywords.

  • Autocompletion and details for variables/functions.

  • Compile straight into development folders with the click of a button.

  • Easy saving/loading of files, as well as project naming.

Bugfixes

  • Mistyped function names now have proper error messages.

  • Fixed issue with if-statement commands not aligning to selected properly.

  • Proper errors when if-statement (selector transformer) is given invalid option.

  • Statements requiring following statements/blocks no longer throw unhandled exceptions.

  • Parenthetical (squashable) statements being $repeated no longer causes unexpected errors.

MCCompiled 1.03

Most of the features here are changes I wished existed when I was working on a larger project. I also hit a couple items off my bucket list and patched some important bugs. I planned for this update to be a hotfix, but uh... you see how that turned out

Changes

  • Null command no longer has rotation parameters since it caused unexpected behavior.

  • Changed null subcommands:

  • null create <string: name> [string: class] [pos: x, y, z]

  • null single <string: name> [string: class] [pos: x, y, z]

  • null remove

  • null remove [name] [class]

  • null class <class>

  • null class remove

  • Changed compiler-generated functions folder name to "compiler" for clarity.

  • count and level if-statement conditions use proper comparison arguments now. (\<, \>\=, \=\=, etc..)

Additions

  • Nulls can now have "classes" which behave similar to tags.

  • Added new if-statement clauses:

  • if null - filter for all null entities

  • if null [name] - filter for all null entities with a certain name.

  • if class <class> - filter for all null entities with a certain class.

  • if position <x|y|z> <operator> <number> - compare position

  • if position <x> <y> <z> - check position These can be placed in tandem to select any combination of nulls.

  • Added -ppv compiler option to set variables from command line.

  • Added new command for which acts as a way of natively executing over entities.

  • Made position, rotation, count, and level if-statements use proper comparison arguments. It just feels SO much better.

Bugfixes

  • Stop normal null creation from behaving like a singleton.

  • Made selector offsets work more consistently outside if-statements.

  • Fixed if-statements where relative coordinates were being aligned to individual entity rather than the executing one.

  • If root file is empty, it will now contain project info to prevent MC compile errors.

MCCompiled 1.02

Changes

  • The damage command now additionally accepts three coordinates for the attacker parameter

  • Selectors can now be specified as strings in the new formats outlined on the cheat sheet.

  • Strings that are in selector format (e.g., "@e[name=Bogey]") will now be parsed during conversion to selector.

  • Language commands (directives) are now held in a JSON file and parsed on startup.

  • Changed how 'blocks' operate internally for better stability in the future.

  • Enum parser was improved and holds more information.

  • Integers using time notation (32m, 5s, etc...) now cache to ensure accurate scaling across commands.

  • Removed pattern validation for if-statements.

  • Internally reworked if-statements and made its processing system modular and portable.

  • Moved "if limit..." to its own "limit" command since it didn't make a whole lot of sense.

Additions

  • New "null" command for creating/removing dummy entities.

  • if any ... will check if any entities match a selector.

  • if count ... will check if the number of entities a selector matches is in a range.

  • Managed entity names can now be used in select.

  • You can now use multiline comments with \/* and *\/

  • Range arguments such as 5.., 1..100, !..6, etc. are now parsed and proper language objects.

  • Book content and leather armor support for give command.

  • New "tag" command for interacting with entity tags.

  • hasitem= is now parsed in selectors.

  • if item and if holding for hasitem interaction.

  • Following select ... by a block will push/pop the selector.

Bugfixes

  • When else statements throw, they will show the correct source location.

  • Commands no longer override internal enum values.

  • Enum parser now accepts values using periods.

  • Fixed an issue where selectors were sometimes improperly merged if a manual selection was performed.

  • Limit now actually works when custom selectors are specified.

MCCompiled 1.01

Changes

  • Removed the --basic compile option.

  • Reworked file system from the ground up--mostly internal changes.

  • Regolith filter support

  • Parentheses now affect squashing order (conforming to PEMDAS).

Features

  • Added offset identifier in if-statements to allow execute offsets.

  • Added --search, searches subfolders and compiles all .mcc files.

  • Added --outputbp, sets behavior pack output folder.

  • Added --outputrp, sets resource pack output folder.

  • Added --outputdevelopment, outputs to com.mojang.

  • Added $iterate which acts as a preprocessor for-loop. Allows for better JSON support.

  • Functions can now have default selectors.

  • init now can take multiple variable inputs.

Bugfixes

  • Fixed small issue with fstrings unnecessarily aligning when they shouldn't.

  • No longer generates resource pack unless necessary.

  • Passing preprocessor variables (still denoted with $) into macro calls will now properly transfer array values.

  • Fixed misalignment with stacked inline function calls.

MCCompiled 1.0

  • Initial release

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/cheat-sheet.html b/mccompiled/docs/cheat-sheet.html index 2900c29..faa5d00 100644 --- a/mccompiled/docs/cheat-sheet.html +++ b/mccompiled/docs/cheat-sheet.html @@ -1,9 +1,9 @@ -Cheat Sheet | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Cheat Sheet

Comments

// <text> - Line comment. Must be at the start of the line and extends to the very end.
/* <text> */ - Multiline comment. Only ends when specified, not at the end of the line.

Code Block

Starts and ends with brackets, holding code inside:

+}

MCCompiled Wiki 1.18.1 Help

Cheat Sheet

Comments

// <text> - Line comment. Must be at the start of the line and extends to the very end.
/* <text> */ - Multiline comment. Only ends when specified, not at the end of the line.

Code Block

Starts and ends with brackets, holding code inside:

... { // inside code block } -

Types

Descriptions of the upcoming types that will be present in the various command arguments.

id

An identifier that either has meaning or doesn't. An identifier can be the name of anything defined in the language, and is usually context dependent. int

Any integral number, like 5, 10, 5291, or -40. Use time suffixes to scale the integer accordingly, like with 4s -> 80.

string

A block of text on a single line, surrounded with either 'single quotes' or "double quotes."

bool

A value that can be either 'true' or 'false.'

selector

A Minecraft selector that targets a specific entity or set of entities. Example: @e[type=cow]

value

The name of a runtime value that was defined using the define command.

coordinate

A Minecraft coordinate value that can optionally be both relative and facing offset, like ~10, 40, or ^5.

enum

Usually a specific keyword in a subset of possible keywords. This type is entirely context dependent.

range

A Minecraft number that specifies a range of integers (inclusive). Omitting a number from one side makes the number unbounded. 4.. means four and up. 1..5 means one through five.

json

A JSON object achieved by $dereferencing a preprocessor variable holding one.

Commands

All the commands in the language (version 1.18). The command ID is the first word of the line, followed by the arguments it gives. Each command parameter includes the type it's allowed to be and its name. A required parameter is surrounded in <angle brackets>, and an optional parameter is surrounded in [square brackets].

Category: preprocessor

Commands that allow the user to do things at compile time. Preprocessor commands generally start with a $ and are highlighted differently than regular commands.

Add to Preprocessor Variable

Adds two preprocessor variables/values together, changing only the first one. A += B

  • $add <id: variable> <object: values>

Append to Preprocessor Variable

Adds the given item(s) to the end of the given preprocessor variable, or contents of another preprocessor variable if specified.

  • $append <id: to modify> <object: items>

  • $append <id: to modify> <id: other>

Decrement Preprocessor Variable

Decrements the given preprocessor variable by one. If multiple values are held, they are all decremented.

  • $dec <id: variable>

Define/Call Macro

If a code-block follows this call, it is treated as a definition. Arguments are passed in as preprocessor variables. If no code-block follows this call, it will attempt to run the macro with any inputs parameters copied to their respective preprocessor variables.

  • $macro <id: name>

Divide Preprocessor Variable

Divides two preprocessor variables/values from each other, changing only the first one. A /= B

  • $div <id: variable> <object: values>

Exponentiate Preprocessor Variable

Exponentiates two preprocessor variables/values with each other, changing only the first one. A = A^B

  • $pow <id: variable> <object: values>

Include File

Places the contents of the given file in replacement for this statement. Not intended for production use yet.

  • $include <string: file>

Increment Preprocessor Variable

Increments the given preprocessor variable by one. If multiple values are held, they are all incremented.

  • $inc <id: variable>

Log to Console

Sends a message to stdout with a line terminator at the end.

  • $log <*: message>

Modulo Preprocessor Variable

Divides two preprocessor variables/values from each other, setting only the first one to the remainder of the operation. A %= B

  • $mod <id: variable> <object: values>

Multiply with Preprocessor Variable

Multiplies two preprocessor variables/values together, changing only the first one. A *= B

  • $mul <id: variable> <object: values>

Prepend to Preprocessor Variable

Adds the given item(s) to the start of the given preprocessor variable.

  • $prepend <id: to modify> <object: items>

  • $prepend <id: to modify> <id: other>

Preprocessor Array Mean

Averages all values in the given preprocessor variable together into one value and stores it in a result variable.

  • $mean <id: result> [id: variable]

Preprocessor Array Median

Gets the middle value/average of the two middle values and stores it in a result variable.

  • $median <id: result> [id: variable]

Preprocessor Array Sort

Sorts the order of the values in the given preprocessor variable either 'ascending' or 'descending'. Values must be comparable.

  • $sort <id: ascending or descending> <id: variable>

Preprocessor Array Sum

Adds all values in the given preprocessor variable together into one value and stores it in a result variable.

  • $sum <id: result> [id: variable]

Preprocessor Array Unique

Flattens the given preprocessor array to only unique values.

  • $unique <id: variable>

Preprocessor Call Function

Calls a function by name and passes in the given parameters. Because this is a preprocessor operation, it has the same error handling as a normal function call.

  • $call <string: function name> [*: parameters]

Preprocessor Else

Directly inverts the result of the last $if call at this level in scope.

Preprocessor If

Compares a preprocessor variable and another value/variable. If the source variable contains multiple values, they all must match the condition.

  • $if <object: a> <compare: comparison> <object: b>

  • $if <id: a> <compare: comparison> <object: b>

  • $if <object: a> <compare: comparison> <id: b>

  • $if <id: a> <compare: comparison> <id: b>

Preprocessor Length

If a preprocessor variable identifier or JSON array is specified, the number of elements it holds is gotten. If a string is given, its length is gotten.

  • $len <id: result> <id: variable>

  • $len <id: result> <json: array>

  • $len <id: result> <string: text>

Preprocessor Load JSON Value

Load a JSON file (if not previously loaded) and retrieve a value from it, storing said value in a preprocessor variable.

  • $json <string: file name> <id: result> [string: path]

  • $json <json: existing json> <id: result> [string: path]

Preprocessor Repeat

Repeats the following statement/code-block a number of times. If a variable identifier is given, that variable will be set to the index of the current iteration. 0, 1, 2, etc.

  • $repeat <int: amount> [id: indicator]

  • $repeat <range: amount> [id: indicator]

Preprocessor Reverse

Reverses the order of the values in the given preprocessor variable.

  • $reverse <id: variable>

Preprocessor String Friendly Name

Convert the given preprocessor variable value(s) to a string in 'Title Case'.

  • $strfriendly <id: result> [id: variable]

Preprocessor String Lowercase

Convert the given preprocessor variable value(s) to a string in 'lowercase'.

  • $strlower <id: result> [id: variable]

Preprocessor String Uppercase

Convert the given preprocessor variable value(s) to a string in 'UPPERCASE'.

  • $strupper <id: result> [id: variable]

Set Preprocessor Variable

Sets a preprocessor variable to the value(s) provided.

  • $var <id: variable> <object: values>

Subtract from Preprocessor Variable

Subtracts two preprocessor variables/values from each other, changing only the first one. A -= B

  • $sub <id: variable> <object: values>

Swap Preprocessor Variables

Swaps the values of two preprocessor variables

  • $swap <id: a> <id: b>

Iterate Preprocessor Array

Runs the following statement/code-block once for each value in the given preprocessor variable. The current iteration is held in the preprocessor variable given. If the target is a JSON array, the elements will be iterated upon.

  • $iterate <id: variable> <id: current>

  • $iterate <json: array or object> <id: current>

Category: text

Commands which display text to players through format-strings, or manipulate text otherwise.

Define/Open Dialogue

If followed by a block, defines a new dialogue scene with the given name.

  • dialogue <id: new> <string: scene tag>

  • dialogue <id: open> <selector: npc> <selector: player> [string: scene tag]

  • dialogue <id: change> <selector: npc> <string: scene tag> [selector: player]

Print to All Players

Prints a chat message to all players in the game. Supports format-strings.

  • globalprint <string: text>

Print to Player

Prints a chat message to the executing player, or to the given one if specified. Supports format-strings.

  • print <selector: entity> <string: text>

  • print <string: text>

Set Active Language

Sets the active lang file (examples: en_US, pt_BR). Once set, all text will automatically be localized into that lang file; including format-strings.

  • lang <id: locale>

Show Actionbar to All Players

Displays an actionbar on the screen of all players in the game. Can also be used to set the timings of the actionbar. Supports format-strings.

  • globalactionbar <string: text>

Show Actionbar

Displays an actionbar on the screen of the executing player, or to the given one if specified. Supports format-strings.

  • actionbar <string: text>

Show Title to All Players

Displays a title on the screen of all players in the game. Can also be used to set the timings of the title. Supports format-strings.

  • globaltitle <id: times> <int: fade in> <int: stay> <int: fade out>

  • globaltitle <id: subtitle> <string: text>

  • globaltitle <string: text>

Show Title

Displays a title on the screen of the executing player, or to the given one if specified. Can also be used to set the timings of the title. Supports format-strings.

  • title <selector: target> <id: times> <int: fade in> <int: stay> <int: fade out>

  • title <selector: target> <id: subtitle> <string: text>

  • title <selector: target> <string: text>

  • title <id: times> <int: fade in> <int: stay> <int: fade out>

  • title <id: subtitle> <string: text>

  • title <string: text>

Say

Send a plain-text message as the executing entity. Plain selectors can be used, but not variables.

  • say <string: message>

Category: entities

Commands which manipulate, spawn, and transform entities in various ways.

Damage Entity

Damages the given entities with a certain cause, optionally coming from a position or blaming an entity by a selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • damage <selector: target> <int: amount> [enum: damage cause]

  • damage <selector: target> <int: amount> [enum: damage cause] <selector: blame>

  • damage <selector: target> <int: amount> [enum: damage cause] <string: blame>

  • damage <selector: target> <int: amount> [enum: damage cause] <coordinate: from x> <coordinate: from y> <coordinate: from z>

Face Towards...

Faces the given entities towards a specific position, selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • face <selector: source> <coordinate: x> <coordinate: y> <coordinate: z>

  • face <selector: source> <selector: other>

  • face <selector: source> <string: other>

Give Effect to Entity

Gives the given entities a potion effect. Time and amplifier can be specified to further customize the potion effect. All potion effects can be cleared using 'effect \<selector\> clear'.

  • effect <selector: target> <id: clear>

  • effect <selector: target> <enum: effect> [int: seconds] [int: amplifier] [bool: hide]

Kill Entity

Kills the given entities, causing the death animation, sounds, and particles to appear.

  • kill [selector: target]

Move Entity

Moves the specified entity in a direction (LEFT, RIGHT, UP, DOWN, FORWARD, BACKWARD) for a certain amount. Simpler alternative for teleporting using caret offsets.

  • move <selector: source> <id: direction> <number: amount> [bool: check for blocks]

Remove Entity

Teleports the given entities deep into the void, causing a silent death. Looking to rewrite this in the future to generate entity code for real removal.

  • remove [selector: target]

Rotate Entity

Rotates the given entities a certain number of degrees horizontally and vertically from their current rotation.

  • rotate <selector: source> <int: y> <int: x>

Summon Entity

Summons an entity; matches Minecraft vanilla syntax.

  • summon <id: type>

  • summon <id: type> <string: name tag> [coordinate: x] [coordinate: y] [coordinate: z]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <coordinate: y rotation> <coordinate: x rotation> [string: spawn event] [string: name tag]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <id: facing> <selector: entity to face> [string: spawn event] [string: name tag]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <id: facing> <coordinate: face x> <coordinate: face y> <coordinate: face z> [string: spawn event] [string: name tag]

Tag Entity

Add and remove tags from the given entity.

  • tag <selector: target> <id: mode> <string: name>

Teleport Entity

Teleports the executing/given entities to a specific position, selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • tp <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <selector: other> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <selector: other> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <string: other> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <string: other> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

Category: blocks

Commands which interact with the Minecraft world's blocks.

Scatter Blocks in Region

Randomly scatters blocks throughout a region with a certain percentage.

  • scatter <string: block> <int: percent> <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> [string: seed]

Fill Region

Fills blocks in a specific region, optionally using a replace mode.

  • fill <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> <string: block> [enum: fill mode] [int: data]

Replace in Region

Replaces all source blocks with a result block in a specific region.

  • replace <string: source block> [int: data] <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> <string: result block> [int: data]

Set Block

Sets the block at a specific position, optionally using a replace mode.

  • setblock <coordinate: x> <coordinate: y> <coordinate: z> <string: block> [int: data] [id: replace mode]

Category: items

Commands relating to entity/player items and inventories.

Give Item

Gives item(s) to the given entity. Runs either a 'give' or 'structure load' depending on requirements. Utilizes builder fields.

  • give <selector: entity> <string: item> [int: amount] [int: data]

Clear Entity

Clears the inventories of all given entities, optionally searching for a specific item and limiting the number of items to remove.

  • clear [selector: target] [string: item] [int: data] [int: max count]

Category: cosmetic

Commands that add visual and auditory appeal to the user's code.

Play Sound

Plays a sound effect in the world, optionally with volume, pitch, and filtering specific players.

  • playsound <string: sound> [selector: who] [coordinate: x] [coordinate: y] [coordinate: z] [number: volume] [number: pitch] [number: minimum volume]

Spawn Particle

Spawns a particle effect in the world.

  • particle <string: effect> [coordinate: x] [coordinate: y] [coordinate: z]

Category: values

Commands tied directly to values. Values can be used in if-statements, format-strings, and many other places.

Define Variable

Defines a variable with a name and type, defaulting to int if unspecified. Can be assigned a value directly after defining.

  • define <*: args>

Initialize Variable

Ensures this variable has a value, defaulting to 0 if not. This ensures the executing entity(s) function as intended all the time. Use clarifiers to pick who the variable is initialized for: e.g., variableName[@a]

  • init <value: value>

Category: logic

Commands which handle logic and code flow. The butter for all the bread (code).

Await (async)

Works in async functions. Awaits a certain amount of time, for a condition to be met, or another async function to complete executing.

  • await <int: ticks>

  • await <id: until> <*: conditions>

  • await <id: while> <*: conditions>

  • await <awaitable: awaitable>

Define Function

Defines a function. Must be followed by a code-block. Parameters must have types, optionally having default values. Function calls look like this: functionName(parameters)

  • function <*: args>

Else Statement

Inverts the comparison given by the previous if-statement at this scope level.

For Each Entity

Runs the following statement or code-block once over every entity that matches a selector at its current position. Functionally equivalent to execute as <selector> at @s run <code>

  • for <selector: entities> <id: at> <coordinate: x> <coordinate: y> <coordinate: z>

  • for <selector: entities>

Halt Execution

Ends the execution of the code entirely by hitting the function command limit.

If Statement

Performs a comparison, only running the proceeding statement/code-block if the comparisons(s) are true. Multiple comparisons can be chained using the keyword 'and', and comparisons can be inverted using the keyword 'not'

Set Return Value

Set the value that will be returned from this function when it ends. The caller can use this value however it wishes.

  • return <value: variable>

  • return <any: return value>

Execute

Begins a vanilla Minecraft execute chain. Can be followed by a statement or code-block, but does not explicitly support the 'run' subcommand.

  • execute <id: subcommand> <*: subcommand arguments>

Repeat N Times

Repeats the proceeding statement/code-block the given number of times. This command always runs at runtime.

  • repeat <int: repetitions> [id: current]

  • repeat <value: repetitions> [id: current]

While Statement

Repeats the proceeding statement/code-block as long as a condition remains true. Multiple comparisons can be chained using the keyword 'and', and comparisons can be inverted using the keyword 'not'

Category: debug

Commands related to testing, debugging and all-around solidifying code.

Assert Statement

Asserts that the given condition evaluates to true, at runtime. If the condition evaluates to false, the code is halted and info is displayed to the executing player(s).

Define Test

Defines a test; requires 'tests' feature. Must be followed by a code-block that contains the test contents.

  • test <id: test name>

Preprocessor Assertion

Asserts that the input comparison is true, and throws a compiler error if not.

  • $assert <object: a> <compare: comparison> <object: b>

  • $assert <id: a> <compare: comparison> <object: b>

  • $assert <object: a> <compare: comparison> <id: b>

  • $assert <id: a> <compare: comparison> <id: b>

Throw Error

Throws an error, displaying it to the executing player(s). The code is halted immediately, so handle cleanup before calling throw. Supports format-strings.

  • throw <string: error>

Category: features

Commands related to the optionally enable-able features in the language.

Create Explosion

Create an explosion at a specific position with optional positioning, power, delay, fire, and block breaking settings. Requires feature 'EXPLODERS' to be enabled.

  • explode [coordinate: x] [coordinate: y] [coordinate: z] [int: power] [int: delay] [bool: causes fire] [bool: breaks blocks]

Enable Feature

Enables a feature to be used for this project, generating any of the necessary files.

  • feature <id: feature name>

Manage Dummy Entities

Create a dummy entity, remove the selected ones, or manage the classes on the selected ones. Requires feature 'DUMMIES' to be enabled.

  • dummy <id: create> <string: name> [string: tag] [coordinate: x] [coordinate: y] [coordinate: x]

  • dummy <id: single> <string: name> [string: tag] [coordinate: x] [coordinate: y] [coordinate: x]

  • dummy <id: removeall> [string: tag]

  • dummy <id: remove> <string: name> [string: tag]

Category: other

The other commands that don't have a good designation.

Minecraft Command

Places a plain command in the output file, used for when the language lacks a certain feature.

  • mc <string: command>

Last modified: 24 April 2024
\ No newline at end of file +

Types

Descriptions of the upcoming types that will be present in the various command arguments.

id

An identifier that either has meaning or doesn't. An identifier can be the name of anything defined in the language, and is usually context dependent. int

Any integral number, like 5, 10, 5291, or -40. Use time suffixes to scale the integer accordingly, like with 4s -> 80.

string

A block of text on a single line, surrounded with either 'single quotes' or "double quotes."

bool

A value that can be either 'true' or 'false.'

selector

A Minecraft selector that targets a specific entity or set of entities. Example: @e[type=cow]

value

The name of a runtime value that was defined using the define command.

coordinate

A Minecraft coordinate value that can optionally be both relative and facing offset, like ~10, 40, or ^5.

enum

Usually a specific keyword in a subset of possible keywords. This type is entirely context dependent.

range

A Minecraft number that specifies a range of integers (inclusive). Omitting a number from one side makes the number unbounded. 4.. means four and up. 1..5 means one through five.

json

A JSON object achieved by $dereferencing a preprocessor variable holding one.

Commands

All the commands in the language (version 1.18). The command ID is the first word of the line, followed by the arguments it gives. Each command parameter includes the type it's allowed to be and its name. A required parameter is surrounded in <angle brackets>, and an optional parameter is surrounded in [square brackets].

Category: preprocessor

Commands that allow the user to do things at compile time. Preprocessor commands generally start with a $ and are highlighted differently than regular commands.

Add to Preprocessor Variable

Adds two preprocessor variables/values together, changing only the first one. A += B

  • $add <id: variable> <object: values>

Append to Preprocessor Variable

Adds the given item(s) to the end of the given preprocessor variable, or contents of another preprocessor variable if specified.

  • $append <id: to modify> <object: items>

  • $append <id: to modify> <id: other>

Decrement Preprocessor Variable

Decrements the given preprocessor variable by one. If multiple values are held, they are all decremented.

  • $dec <id: variable>

Define/Call Macro

If a code-block follows this call, it is treated as a definition. Arguments are passed in as preprocessor variables. If no code-block follows this call, it will attempt to run the macro with any inputs parameters copied to their respective preprocessor variables.

  • $macro <id: name>

Divide Preprocessor Variable

Divides two preprocessor variables/values from each other, changing only the first one. A /= B

  • $div <id: variable> <object: values>

Exponentiate Preprocessor Variable

Exponentiates two preprocessor variables/values with each other, changing only the first one. A = A^B

  • $pow <id: variable> <object: values>

Include File

Places the contents of the given file in replacement for this statement. Not intended for production use yet.

  • $include <string: file>

Increment Preprocessor Variable

Increments the given preprocessor variable by one. If multiple values are held, they are all incremented.

  • $inc <id: variable>

Log to Console

Sends a message to stdout with a line terminator at the end.

  • $log <*: message>

Modulo Preprocessor Variable

Divides two preprocessor variables/values from each other, setting only the first one to the remainder of the operation. A %= B

  • $mod <id: variable> <object: values>

Multiply with Preprocessor Variable

Multiplies two preprocessor variables/values together, changing only the first one. A *= B

  • $mul <id: variable> <object: values>

Prepend to Preprocessor Variable

Adds the given item(s) to the start of the given preprocessor variable.

  • $prepend <id: to modify> <object: items>

  • $prepend <id: to modify> <id: other>

Preprocessor Array Mean

Averages all values in the given preprocessor variable together into one value and stores it in a result variable.

  • $mean <id: result> [id: variable]

Preprocessor Array Median

Gets the middle value/average of the two middle values and stores it in a result variable.

  • $median <id: result> [id: variable]

Preprocessor Array Sort

Sorts the order of the values in the given preprocessor variable either 'ascending' or 'descending'. Values must be comparable.

  • $sort <id: ascending or descending> <id: variable>

Preprocessor Array Sum

Adds all values in the given preprocessor variable together into one value and stores it in a result variable.

  • $sum <id: result> [id: variable]

Preprocessor Array Unique

Flattens the given preprocessor array to only unique values.

  • $unique <id: variable>

Preprocessor Call Function

Calls a function by name and passes in the given parameters. Because this is a preprocessor operation, it has the same error handling as a normal function call.

  • $call <string: function name> [*: parameters]

Preprocessor Else

Directly inverts the result of the last $if call at this level in scope.

Preprocessor If

Compares a preprocessor variable and another value/variable. If the source variable contains multiple values, they all must match the condition.

  • $if <object: a> <compare: comparison> <object: b>

  • $if <id: a> <compare: comparison> <object: b>

  • $if <object: a> <compare: comparison> <id: b>

  • $if <id: a> <compare: comparison> <id: b>

Preprocessor Length

If a preprocessor variable identifier or JSON array is specified, the number of elements it holds is gotten. If a string is given, its length is gotten.

  • $len <id: result> <id: variable>

  • $len <id: result> <json: array>

  • $len <id: result> <string: text>

Preprocessor Load JSON Value

Load a JSON file (if not previously loaded) and retrieve a value from it, storing said value in a preprocessor variable.

  • $json <string: file name> <id: result> [string: path]

  • $json <json: existing json> <id: result> [string: path]

Preprocessor Repeat

Repeats the following statement/code-block a number of times. If a variable identifier is given, that variable will be set to the index of the current iteration. 0, 1, 2, etc.

  • $repeat <int: amount> [id: indicator]

  • $repeat <range: amount> [id: indicator]

Preprocessor Reverse

Reverses the order of the values in the given preprocessor variable.

  • $reverse <id: variable>

Preprocessor String Friendly Name

Convert the given preprocessor variable value(s) to a string in 'Title Case'.

  • $strfriendly <id: result> [id: variable]

Preprocessor String Lowercase

Convert the given preprocessor variable value(s) to a string in 'lowercase'.

  • $strlower <id: result> [id: variable]

Preprocessor String Uppercase

Convert the given preprocessor variable value(s) to a string in 'UPPERCASE'.

  • $strupper <id: result> [id: variable]

Set Preprocessor Variable

Sets a preprocessor variable to the value(s) provided.

  • $var <id: variable> <object: values>

Subtract from Preprocessor Variable

Subtracts two preprocessor variables/values from each other, changing only the first one. A -= B

  • $sub <id: variable> <object: values>

Swap Preprocessor Variables

Swaps the values of two preprocessor variables

  • $swap <id: a> <id: b>

Iterate Preprocessor Array

Runs the following statement/code-block once for each value in the given preprocessor variable. The current iteration is held in the preprocessor variable given. If the target is a JSON array, the elements will be iterated upon.

  • $iterate <id: variable> <id: current>

  • $iterate <json: array or object> <id: current>

Category: text

Commands which display text to players through format-strings, or manipulate text otherwise.

Define/Open Dialogue

If followed by a block, defines a new dialogue scene with the given name.

  • dialogue <id: new> <string: scene tag>

  • dialogue <id: open> <selector: npc> <selector: player> [string: scene tag]

  • dialogue <id: change> <selector: npc> <string: scene tag> [selector: player]

Print to All Players

Prints a chat message to all players in the game. Supports format-strings.

  • globalprint <string: text>

Print to Player

Prints a chat message to the executing player, or to the given one if specified. Supports format-strings.

  • print <selector: entity> <string: text>

  • print <string: text>

Set Active Language

Sets the active lang file (examples: en_US, pt_BR). Once set, all text will automatically be localized into that lang file; including format-strings.

  • lang <id: locale>

Show Actionbar to All Players

Displays an actionbar on the screen of all players in the game. Can also be used to set the timings of the actionbar. Supports format-strings.

  • globalactionbar <string: text>

Show Actionbar

Displays an actionbar on the screen of the executing player, or to the given one if specified. Supports format-strings.

  • actionbar <string: text>

Show Title to All Players

Displays a title on the screen of all players in the game. Can also be used to set the timings of the title. Supports format-strings.

  • globaltitle <id: times> <int: fade in> <int: stay> <int: fade out>

  • globaltitle <id: subtitle> <string: text>

  • globaltitle <string: text>

Show Title

Displays a title on the screen of the executing player, or to the given one if specified. Can also be used to set the timings of the title. Supports format-strings.

  • title <selector: target> <id: times> <int: fade in> <int: stay> <int: fade out>

  • title <selector: target> <id: subtitle> <string: text>

  • title <selector: target> <string: text>

  • title <id: times> <int: fade in> <int: stay> <int: fade out>

  • title <id: subtitle> <string: text>

  • title <string: text>

Say

Send a plain-text message as the executing entity. Plain selectors can be used, but not variables.

  • say <string: message>

Category: entities

Commands which manipulate, spawn, and transform entities in various ways.

Damage Entity

Damages the given entities with a certain cause, optionally coming from a position or blaming an entity by a selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • damage <selector: target> <int: amount> [enum: damage cause]

  • damage <selector: target> <int: amount> [enum: damage cause] <selector: blame>

  • damage <selector: target> <int: amount> [enum: damage cause] <string: blame>

  • damage <selector: target> <int: amount> [enum: damage cause] <coordinate: from x> <coordinate: from y> <coordinate: from z>

Face Towards...

Faces the given entities towards a specific position, selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • face <selector: source> <coordinate: x> <coordinate: y> <coordinate: z>

  • face <selector: source> <selector: other>

  • face <selector: source> <string: other>

Give Effect to Entity

Gives the given entities a potion effect. Time and amplifier can be specified to further customize the potion effect. All potion effects can be cleared using 'effect \<selector\> clear'.

  • effect <selector: target> <id: clear>

  • effect <selector: target> <enum: effect> [int: seconds] [int: amplifier] [bool: hide]

Kill Entity

Kills the given entities, causing the death animation, sounds, and particles to appear.

  • kill [selector: target]

Move Entity

Moves the specified entity in a direction (LEFT, RIGHT, UP, DOWN, FORWARD, BACKWARD) for a certain amount. Simpler alternative for teleporting using caret offsets.

  • move <selector: source> <id: direction> <number: amount> [bool: check for blocks]

Remove Entity

Teleports the given entities deep into the void, causing a silent death. Looking to rewrite this in the future to generate entity code for real removal.

  • remove [selector: target]

Rotate Entity

Rotates the given entities a certain number of degrees horizontally and vertically from their current rotation.

  • rotate <selector: source> <int: y> <int: x>

Summon Entity

Summons an entity; matches Minecraft vanilla syntax.

  • summon <id: type>

  • summon <id: type> <string: name tag> [coordinate: x] [coordinate: y] [coordinate: z]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <coordinate: y rotation> <coordinate: x rotation> [string: spawn event] [string: name tag]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <id: facing> <selector: entity to face> [string: spawn event] [string: name tag]

  • summon <id: type> <coordinate: x> <coordinate: y> <coordinate: z> <id: facing> <coordinate: face x> <coordinate: face y> <coordinate: face z> [string: spawn event] [string: name tag]

Tag Entity

Add and remove tags from the given entity.

  • tag <selector: target> <id: mode> <string: name>

Teleport Entity

Teleports the executing/given entities to a specific position, selector, "name:type" of entity, or name of another managed entity (e.g., dummy entities).

  • tp <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <coordinate: x> <coordinate: y> <coordinate: z> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <selector: other> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <selector: other> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

  • tp <selector: source> <string: other> [id: facing] [selector: face entity] [bool: check for blocks]

  • tp <selector: source> <string: other> [id: facing] [coordinate: facing x] [coordinate: facing y] [coordinate: facing z] [bool: check for blocks]

Category: blocks

Commands which interact with the Minecraft world's blocks.

Scatter Blocks in Region

Randomly scatters blocks throughout a region with a certain percentage.

  • scatter <string: block> <int: percent> <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> [string: seed]

Fill Region

Fills blocks in a specific region, optionally using a replace mode.

  • fill <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> <string: block> [enum: fill mode] [int: data]

Replace in Region

Replaces all source blocks with a result block in a specific region.

  • replace <string: source block> [int: data] <coordinate: x1> <coordinate: y1> <coordinate: z1> <coordinate: x2> <coordinate: y2> <coordinate: z2> <string: result block> [int: data]

Set Block

Sets the block at a specific position, optionally using a replace mode.

  • setblock <coordinate: x> <coordinate: y> <coordinate: z> <string: block> [int: data] [id: replace mode]

Category: items

Commands relating to entity/player items and inventories.

Give Item

Gives item(s) to the given entity. Runs either a 'give' or 'structure load' depending on requirements. Utilizes builder fields.

  • give <selector: entity> <string: item> [int: amount] [int: data]

Clear Entity

Clears the inventories of all given entities, optionally searching for a specific item and limiting the number of items to remove.

  • clear [selector: target] [string: item] [int: data] [int: max count]

Category: cosmetic

Commands that add visual and auditory appeal to the user's code.

Play Sound

Plays a sound effect in the world, optionally with volume, pitch, and filtering specific players.

  • playsound <string: sound> [selector: who] [coordinate: x] [coordinate: y] [coordinate: z] [number: volume] [number: pitch] [number: minimum volume]

Spawn Particle

Spawns a particle effect in the world.

  • particle <string: effect> [coordinate: x] [coordinate: y] [coordinate: z]

Category: values

Commands tied directly to values. Values can be used in if-statements, format-strings, and many other places.

Define Variable

Defines a variable with a name and type, defaulting to int if unspecified. Can be assigned a value directly after defining.

  • define <*: args>

Initialize Variable

Ensures this variable has a value, defaulting to 0 if not. This ensures the executing entity(s) function as intended all the time. Use clarifiers to pick who the variable is initialized for: e.g., variableName[@a]

  • init <value: value>

Category: logic

Commands which handle logic and code flow. The butter for all the bread (code).

Await (async)

Works in async functions. Awaits a certain amount of time, for a condition to be met, or another async function to complete executing.

  • await <int: ticks>

  • await <id: until> <*: conditions>

  • await <id: while> <*: conditions>

  • await <awaitable: awaitable>

Define Function

Defines a function. Must be followed by a code-block. Parameters must have types, optionally having default values. Function calls look like this: functionName(parameters)

  • function <*: args>

Else Statement

Inverts the comparison given by the previous if-statement at this scope level.

For Each Entity

Runs the following statement or code-block once over every entity that matches a selector at its current position. Functionally equivalent to execute as <selector> at @s run <code>

  • for <selector: entities> <id: at> <coordinate: x> <coordinate: y> <coordinate: z>

  • for <selector: entities>

Halt Execution

Ends the execution of the code entirely by hitting the function command limit.

If Statement

Performs a comparison, only running the proceeding statement/code-block if the comparisons(s) are true. Multiple comparisons can be chained using the keyword 'and', and comparisons can be inverted using the keyword 'not'

Set Return Value

Set the value that will be returned from this function when it ends. The caller can use this value however it wishes.

  • return <value: variable>

  • return <any: return value>

Execute

Begins a vanilla Minecraft execute chain. Can be followed by a statement or code-block, but does not explicitly support the 'run' subcommand.

  • execute <id: subcommand> <*: subcommand arguments>

Repeat N Times

Repeats the proceeding statement/code-block the given number of times. This command always runs at runtime.

  • repeat <int: repetitions> [id: current]

  • repeat <value: repetitions> [id: current]

While Statement

Repeats the proceeding statement/code-block as long as a condition remains true. Multiple comparisons can be chained using the keyword 'and', and comparisons can be inverted using the keyword 'not'

Category: debug

Commands related to testing, debugging and all-around solidifying code.

Assert Statement

Asserts that the given condition evaluates to true, at runtime. If the condition evaluates to false, the code is halted and info is displayed to the executing player(s).

Define Test

Defines a test; requires 'tests' feature. Must be followed by a code-block that contains the test contents.

  • test <id: test name>

Preprocessor Assertion

Asserts that the input comparison is true, and throws a compiler error if not.

  • $assert <object: a> <compare: comparison> <object: b>

  • $assert <id: a> <compare: comparison> <object: b>

  • $assert <object: a> <compare: comparison> <id: b>

  • $assert <id: a> <compare: comparison> <id: b>

Throw Error

Throws an error, displaying it to the executing player(s). The code is halted immediately, so handle cleanup before calling throw. Supports format-strings.

  • throw <string: error>

Category: features

Commands related to the optionally enable-able features in the language.

Create Explosion

Create an explosion at a specific position with optional positioning, power, delay, fire, and block breaking settings. Requires feature 'EXPLODERS' to be enabled.

  • explode [coordinate: x] [coordinate: y] [coordinate: z] [int: power] [int: delay] [bool: causes fire] [bool: breaks blocks]

Enable Feature

Enables a feature to be used for this project, generating any of the necessary files.

  • feature <id: feature name>

Manage Dummy Entities

Create a dummy entity, remove the selected ones, or manage the classes on the selected ones. Requires feature 'DUMMIES' to be enabled.

  • dummy <id: create> <string: name> [string: tag] [coordinate: x] [coordinate: y] [coordinate: x]

  • dummy <id: single> <string: name> [string: tag] [coordinate: x] [coordinate: y] [coordinate: x]

  • dummy <id: removeall> [string: tag]

  • dummy <id: remove> <string: name> [string: tag]

Category: other

The other commands that don't have a good designation.

Minecraft Command

Places a plain command in the output file, used for when the language lacks a certain feature.

  • mc <string: command>

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/commands-deep-dives.html b/mccompiled/docs/commands-deep-dives.html index 32de748..ad583e2 100644 --- a/mccompiled/docs/commands-deep-dives.html +++ b/mccompiled/docs/commands-deep-dives.html @@ -1,9 +1,9 @@ -Commands Deep-Dives | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Commands Deep-Dives

Some commands in MCCompiled are complex enough that they deserve their own documentation. All subtopics under this page are deep-dives into these commands.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Commands Deep-Dives

Some commands in MCCompiled are complex enough that they deserve their own documentation. All subtopics under this page are deep-dives into these commands.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/comparison-compile-time.html b/mccompiled/docs/comparison-compile-time.html index 1a4c08c..e42ee37 100644 --- a/mccompiled/docs/comparison-compile-time.html +++ b/mccompiled/docs/comparison-compile-time.html @@ -1,9 +1,9 @@ -Comparison (compile-time) | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Comparison (compile-time)

Comparison is the backbone of logic in both runtime and compile-time code. This page will focus on the compile-time side of comparison.

Simple Comparison

Comparison is formatted universally the same. The primary way of performing a comparison is using $if, but the $assert command also shares the same syntax. Comparison compares the left and right side using one of six different operators:

Checks if the left and right sides are equal to each other.


+}

MCCompiled Wiki 1.18.1 Help

Comparison (compile-time)

Comparison is the backbone of logic in both runtime and compile-time code. This page will focus on the compile-time side of comparison.

Simple Comparison

Comparison is formatted universally the same. The primary way of performing a comparison is using $if, but the $assert command also shares the same syntax. Comparison compares the left and right side using one of six different operators:

Checks if the left and right sides are equal to each other.


$if left == right { // ... } -

Checks if the left and right sides are not equal to each other.


+

Checks if the left and right sides are not equal to each other.


$if left != right { // ... } -

Checks if the left side is less than the right side.


+

Checks if the left side is less than the right side.


$if left < right { // ... } -

Checks if the left side is less or equal to the right side.


+

Checks if the left side is less or equal to the right side.


$if left <= right { // ... } -

Checks if the left side is more (greater) than the right side.


+

Checks if the left side is more (greater) than the right side.


$if left > right { // ... } -

Checks if the left side is more (greater) or equal to the right side.


+

Checks if the left side is more (greater) or equal to the right side.


$if left >= right { // ... } -

Using If

The $if command runs a comparison and performs the next statement/block only if it evaluates true.

The example below shows a macro which runs effect @s clear if the input effect is equal to "clear."

+

Using If

The $if command runs a comparison and performs the next statement/block only if it evaluates true.

The example below shows a macro which runs effect @s clear if the input effect is equal to "clear."

$macro giveEffect effectName { $if effectName == "clear" effect @s clear } -

Using Else

The $else command looks at the result of the last $if command that was run in the same block, and only performs the next statement/block if that $if command didn't result with true. It's essentially the inverse.

This example expands and finishes the above example by adding $else to cover cases where the effect is not "clear."

+

Using Else

The $else command looks at the result of the last $if command that was run in the same block, and only performs the next statement/block if that $if command didn't result with true. It's essentially the inverse.

This example expands and finishes the above example by adding $else to cover cases where the effect is not "clear."

$macro giveEffect effectName { $if effectName == "clear" effect @s clear @@ -56,4 +56,4 @@ print "You've received the effect $effectName!" } } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/comparison.html b/mccompiled/docs/comparison.html index 5785c4f..8d50948 100644 --- a/mccompiled/docs/comparison.html +++ b/mccompiled/docs/comparison.html @@ -1,9 +1,9 @@ -Comparison | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Comparison

Comparison is the most important part of writing any logic, and a majority of MCCompiled code will contain comparisons of some sort. Comparison is primarily done with two commands: if and else.

Syntax

An if statement accepts as many comparisons at once as you would like. Each comparison must be separated by the and keyword to indicate to MCCompiled that the last comparison ended.

+}

MCCompiled Wiki 1.18.1 Help

Comparison

Comparison is the most important part of writing any logic, and a majority of MCCompiled code will contain comparisons of some sort. Comparison is primarily done with two commands: if and else.

Syntax

An if statement accepts as many comparisons at once as you would like. Each comparison must be separated by the and keyword to indicate to MCCompiled that the last comparison ended.

if <comparison>
if <comparison> and <comparison> and /* ...continue... */ -

if statements must be followed by either a block or single statement which will only be run if all the comparisons in the command evaluate true.

Else

After an if statement ends (as well as its block/statement), you can choose to place an else command too. The else command follows the same rules about how it needs to be followed by either a block or single statement.

+

if statements must be followed by either a block or single statement which will only be run if all the comparisons in the command evaluate true.

Else

After an if statement ends (as well as its block/statement), you can choose to place an else command too. The else command follows the same rules about how it needs to be followed by either a block or single statement.

if <comparison> { // code to run if true @@ -26,39 +26,39 @@ { // code to run if false } -

Inverting a Comparison

You can invert a comparison by specifying not before it. In doing so, you check if the comparison evaluates false instead of true.

+

Inverting a Comparison

You can invert a comparison by specifying not before it. In doing so, you check if the comparison evaluates false instead of true.

if not <comparison> -

Value Comparison

Values can be compared to one another, or compared to literal values. Comparisons automagically handle all the necessary type conversion, ranges, setup, etc. for you so that you can focus more on the logic than extraneous stuff.

When comparing values, the syntax of the comparison is <a> <operator> <b>. The parameter a can be any value or literal, as well as b.

The operator can be any of the following, which decides what case A and B have to match in order for the comparison to be true.

Checks if A and B are equal.


+

Value Comparison

Values can be compared to one another, or compared to literal values. Comparisons automagically handle all the necessary type conversion, ranges, setup, etc. for you so that you can focus more on the logic than extraneous stuff.

When comparing values, the syntax of the comparison is <a> <operator> <b>. The parameter a can be any value or literal, as well as b.

The operator can be any of the following, which decides what case A and B have to match in order for the comparison to be true.

Checks if A and B are equal.


if a == b { // ... } -

Checks if A and B are not equal.


+

Checks if A and B are not equal.


if a != b { // ... } -

Checks if A is less than B.


+

Checks if A is less than B.


if a < b { // ... } -

Checks if A is less than or equal to B.


+

Checks if A is less than or equal to B.


if a <= b { // ... } -

Checks if A is more (greater) than B.


+

Checks if A is more (greater) than B.


if a > b { // ... } -

Checks if A is more (greater) than or equal to B.


+

Checks if A is more (greater) than or equal to B.


if a >= b { // ... } -

Value Comparison Example

The following example checks if the player is in debt; if their balance is less than 0, then they are in debt.

+

Value Comparison Example

The following example checks if the player is in debt; if their balance is less than 0, then they are in debt.

define int balance if balance < 0 { print "You are in debt!" } -

Let's expand on this example by adding an else statement and adding another if statement. If the player has enough money to buy the item (indicated by cost), they'll receive the item and pay the cost. If the player doesn't have enough money, they will be let know and nothing will happen.

+

Let's expand on this example by adding an else statement and adding another if statement. If the player has enough money to buy the item (indicated by cost), they'll receive the item and pay the cost. If the player doesn't have enough money, they will be let know and nothing will happen.

define int balance define int cost @@ -76,30 +76,30 @@ else print "You don't have enough money! Missing {cost - balance}" } -

Comparing Booleans

If you have a boolean value, you can compare it as normal or completely omit the operator and B value. When you do this, you are implicitly checking if the boolean is true. With the not operator, you can check if the boolean is false.

+

Comparing Booleans

If you have a boolean value, you can compare it as normal or completely omit the operator and B value. When you do this, you are implicitly checking if the boolean is true. With the not operator, you can check if the boolean is false.

define bool isJumping if isJumping { // the player is jumping } -

Selector Comparison

If you want to compare using a selector, specify the selector as-is. This form requires the selector be @s to keep its meaning concise. The following example shows using this comparison to check if the executing player has a tag:

+

Selector Comparison

If you want to compare using a selector, specify the selector as-is. This form requires the selector be @s to keep its meaning concise. The following example shows using this comparison to check if the executing player has a tag:

if @s[tag=safe] { // ... } -

Entity Comparison

There are two different comparison methods of checking entities, besides selectors (seen above).

Any

Check if any entity matches the given selector.

  • any <selector>

+

Entity Comparison

There are two different comparison methods of checking entities, besides selectors (seen above).

Any

Check if any entity matches the given selector.

  • any <selector>

if any @e[r=10,type=cow] { // found a cow somewhere nearby } -
Count

Counts the given selector and checks it as if it was a value. Supports all the operators seen above and can be compared to other values or literals.

  • count <selector> <operator> <b>

+
Count

Counts the given selector and checks it as if it was a value. Supports all the operators seen above and can be compared to other values or literals.

  • count <selector> <operator> <b>

if count @e[type=cow] > 10 { // cow overpopulation (more than 10) } -

Block Comparison

Allows you to check for individual blocks or groups of blocks within the world. Like with all other comparisons, you can invert these with not for use-cases like checking if a block is not air.

Block

Checks for a block at specific coordinates.

  • block <x, y, z> <block>

+

Block Comparison

Allows you to check for individual blocks or groups of blocks within the world. Like with all other comparisons, you can invert these with not for use-cases like checking if a block is not air.

Block

Checks for a block at specific coordinates.

  • block <x, y, z> <block>

if block ~ ~-1 ~ air { // player is in the air } -
Blocks

Checks if a region of blocks matches another region.

  • blocks <region-start x, y, z> <region-end x, y, z> <dest x, y, z> all

  • blocks <region-start x, y, z> <region-end x, y, z> <dest x, y, z> masked

+
Blocks

Checks if a region of blocks matches another region.

  • blocks <region-start x, y, z> <region-end x, y, z> <dest x, y, z> all

  • blocks <region-start x, y, z> <region-end x, y, z> <dest x, y, z> masked

if blocks 0 0 0 10 10 10 30 0 30 { // region matched } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/compile-time-loops.html b/mccompiled/docs/compile-time-loops.html index 28e0d00..3502d38 100644 --- a/mccompiled/docs/compile-time-loops.html +++ b/mccompiled/docs/compile-time-loops.html @@ -1,9 +1,9 @@ -Loops (compile-time) | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Loops (compile-time)

Sometimes you need to do things multiple times; an especially powerful tool at compile time. There are two primary types of iteration in MCCompiled:

  1. Repeating a certain number of times.

  2. Iterating over a given value.

Repeating N Times

Repeating a statement/set of statements some number of times is useful in lots of cases. As such, MCCompiled's $repeat command is a powerful and simple choice for doing this. This page discusses the preprocessor version of the command, which runs exclusively at compile time. See runtime repeat here.

An example is shown here summoning 10 zombies at the given coordinates.

+}

MCCompiled Wiki 1.18.1 Help

Loops (compile-time)

Sometimes you need to do things multiple times; an especially powerful tool at compile time. There are two primary types of iteration in MCCompiled:

  1. Repeating a certain number of times.

  2. Iterating over a given value.

Repeating N Times

Repeating a statement/set of statements some number of times is useful in lots of cases. As such, MCCompiled's $repeat command is a powerful and simple choice for doing this. This page discusses the preprocessor version of the command, which runs exclusively at compile time. See runtime repeat here.

An example is shown here summoning 10 zombies at the given coordinates.

$repeat 10 { summon zombie 304 -391 1047 } -

Current Iteration

Sometimes it's also necessary to know what iteration the repeat is currently on. For this, you can specify the second parameter, which is the identifier of the preprocessor variable to store the current iteration in.

When iterating a single digit like this, the variable always begins at zero and ends at the ending number minus one. In the following example, the identifier xOffset is used, and then its value is used to offset where each zombie is spawned. xOffset begins at 0, and ends at 9, covering 10 total digits.

+

Current Iteration

Sometimes it's also necessary to know what iteration the repeat is currently on. For this, you can specify the second parameter, which is the identifier of the preprocessor variable to store the current iteration in.

When iterating a single digit like this, the variable always begins at zero and ends at the ending number minus one. In the following example, the identifier xOffset is used, and then its value is used to offset where each zombie is spawned. xOffset begins at 0, and ends at 9, covering 10 total digits.

$repeat 10 xOffset { summon zombie (304 + $xOffset) -391 1047 } -

Iterating Over Ranges

When you want an iteration to have an upper and lower bound, you can use a range as an input rather than a single number. Like in regular Minecraft, ranges are always inclusive; so 2..5 includes the indices 2, 3, 4, 5.

+

Iterating Over Ranges

When you want an iteration to have an upper and lower bound, you can use a range as an input rather than a single number. Like in regular Minecraft, ranges are always inclusive; so 2..5 includes the indices 2, 3, 4, 5.

$repeat 50..100 i { setblock ~ (~ + $i) (~ + $i) stone print "Stairway created." } -

Iterating over Arrays

When you want to iterate over the elements in an object but don't care about the location it's at, the $iterate command is the best choice. The syntax of the iterate command is $iterate [object] [id: current]. The argument 'current' will be the name of the preprocessor variable that stores the current element in the iteration.

Preprocessor Variable Elements

The most simple iteration you can do is over the elements in a preprocessor variable. To specify a preprocessor variable, enter its identifier as the input for "object." Regardless of what's stored in the preprocessor variable, its elements are guaranteed to be iterated over (even if it contains one element).

+

Iterating over Arrays

When you want to iterate over the elements in an object but don't care about the location it's at, the $iterate command is the best choice. The syntax of the iterate command is $iterate [object] [id: current]. The argument 'current' will be the name of the preprocessor variable that stores the current element in the iteration.

Preprocessor Variable Elements

The most simple iteration you can do is over the elements in a preprocessor variable. To specify a preprocessor variable, enter its identifier as the input for "object." Regardless of what's stored in the preprocessor variable, its elements are guaranteed to be iterated over (even if it contains one element).

$var colors "red" "orange" "yellow" "green" "blue" "purple" $iterate colors color { give @s "$color_wool" 16 } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/compiling-manually.html b/mccompiled/docs/compiling-manually.html index 0b316e9..5b65545 100644 --- a/mccompiled/docs/compiling-manually.html +++ b/mccompiled/docs/compiling-manually.html @@ -1,9 +1,9 @@ -Compiling Manually | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Compiling Manually

When you need to control how your project is compiled, it's best to do it from the command line. There are lots of parameters that can adjust how your code is compiled and emitted, beyond what you can do with just the editor.

Simple Compilation

Compiling a .mcc file is as simple as running the command:

+}

MCCompiled Wiki 1.18.1 Help

Compiling Manually

When you need to control how your project is compiled, it's best to do it from the command line. There are lots of parameters that can adjust how your code is compiled and emitted, beyond what you can do with just the editor.

Simple Compilation

Compiling a .mcc file is as simple as running the command:

mc-compiled [file] [args...] -

Doing this will open the file, compile its contents, and then write the output to the current directory. If the result of a previous compilation is in the directory, then MCCompiled will always amend to that output rather than create a new one.

For example, if you exported a file named egg.mcc, it would not repeatedly create new egg Behavior Packs every time you compiled. MCCompiled would instead only create the Behavior Pack the first time, then amend to it each time after.

Changing Output Location

You have control over where both the behavior pack and resource pack end up, as well as an option for targeting the Minecraft UWP development folders if needed.

Manual Location

Specifying manual location can be done using input parameters; one for behavior pack location, and one for resource pack location.

--outputbp (-obp)

Sets the output location of the behavior pack.

--outputrp (-orp)

Sets the output location of the resource pack.

When using output location, you can use ?project to denote the name of the project being exported.

Development Location

If you want the behavior and resource pack to be written into the development_behavior_packs and development_resource_packs folders respectively, there is a single compiler parameter that does not take an input.

--outputdevelopment (-od)

Sets the output location of both the behavior and resource packs to the Minecraft development folders.

Project Name

The "Project Name" is what defines how the code is compiled to the various files; specifically, the paths of the output folders, and the name of the project in the manifest.json files. Outputting to the development folders uses the fairly standard format ?project_BP and ?project_RP. When manually setting output, try to always use ?project to denote file name in case you ever change it.

By default, the project name is a stripped/lowercase version of the root file name; as in, the one passed into the compiler. You can set it manually, however.

--project (-p)

Sets the name of the project being compiled, instead of the stripped file name.

Extra Compile Options

There are also some less useful options you may consider looking at to see if they fit your use case. The goal is eventually to be able to fully cover most use cases that niche users would have, so if there's something missing, open an issue or even submit your own PR in the GitHub.

Last modified: 24 April 2024
\ No newline at end of file +

Doing this will open the file, compile its contents, and then write the output to the current directory. If the result of a previous compilation is in the directory, then MCCompiled will always amend to that output rather than create a new one.

For example, if you exported a file named egg.mcc, it would not repeatedly create new egg Behavior Packs every time you compiled. MCCompiled would instead only create the Behavior Pack the first time, then amend to it each time after.

Changing Output Location

You have control over where both the behavior pack and resource pack end up, as well as an option for targeting the Minecraft UWP development folders if needed.

Manual Location

Specifying manual location can be done using input parameters; one for behavior pack location, and one for resource pack location.

--outputbp (-obp)

Sets the output location of the behavior pack.

--outputrp (-orp)

Sets the output location of the resource pack.

When using output location, you can use ?project to denote the name of the project being exported.

Development Location

If you want the behavior and resource pack to be written into the development_behavior_packs and development_resource_packs folders respectively, there is a single compiler parameter that does not take an input.

--outputdevelopment (-od)

Sets the output location of both the behavior and resource packs to the Minecraft development folders.

Project Name

The "Project Name" is what defines how the code is compiled to the various files; specifically, the paths of the output folders, and the name of the project in the manifest.json files. Outputting to the development folders uses the fairly standard format ?project_BP and ?project_RP. When manually setting output, try to always use ?project to denote file name in case you ever change it.

By default, the project name is a stripped/lowercase version of the root file name; as in, the one passed into the compiler. You can set it manually, however.

--project (-p)

Sets the name of the project being compiled, instead of the stripped file name.

Extra Compile Options

There are also some less useful options you may consider looking at to see if they fit your use case. The goal is eventually to be able to fully cover most use cases that niche users would have, so if there's something missing, open an issue or even submit your own PR in the GitHub.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/config.json b/mccompiled/docs/config.json index aa95879..8b00ce1 100644 --- a/mccompiled/docs/config.json +++ b/mccompiled/docs/config.json @@ -1 +1 @@ -{"productWebUrl":"https://github.com/7UKECREAT0R/MCCompiled","searchAlgoliaId":"FTRF1XZFC5","searchAlgoliaApiKey":"251545e04ecfab238d6c36f73a45acda","searchAlgoliaIndexName":"docs","productId":"mccompiled/docs","keymaps":{},"downloadPage":"https://github.com/7UKECREAT0R/MCCompiled","logoUrl":"images/icon_transparent.png","productName":"MCCompiled Wiki","productVersion":"1.18","stage":"release","downloadTitle":"Download","searchService":"algolia","showDownloadButton":true,"searchMaxHits":75} \ No newline at end of file +{"productWebUrl":"https://github.com/7UKECREAT0R/MCCompiled","searchAlgoliaApiKey":"251545e04ecfab238d6c36f73a45acda","searchAlgoliaId":"FTRF1XZFC5","searchAlgoliaIndexName":"docs","productId":"mccompiled/docs","keymaps":{},"downloadPage":"https://github.com/7UKECREAT0R/MCCompiled","logoUrl":"images/icon_transparent.png","productName":"MCCompiled Wiki","productVersion":"1.18.1","stage":"release","downloadTitle":"Download","searchService":"algolia","showDownloadButton":true,"searchMaxHits":75} \ No newline at end of file diff --git a/mccompiled/docs/current.help.version b/mccompiled/docs/current.help.version index d907c15..5ce8b39 100644 --- a/mccompiled/docs/current.help.version +++ b/mccompiled/docs/current.help.version @@ -1 +1 @@ -1.18 \ No newline at end of file +1.18.1 \ No newline at end of file diff --git a/mccompiled/docs/debugging.html b/mccompiled/docs/debugging.html index 015385e..0b2d2e5 100644 --- a/mccompiled/docs/debugging.html +++ b/mccompiled/docs/debugging.html @@ -1,9 +1,9 @@ -Debugging | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Debugging

Sometimes, when working on a project, things don't work as you expect. You may also wish to add guards which make sure that the project can only be compiled if certain things are working as you expect.

MCCompiled has two commands made for debugging and guarding against bugs.

Logging

The $log command accepts any inputs of any amount. It will print the input tokens to the console when compiled, separated by spaces. The log command works just as good with a single string specified, too.

Logging is useful to get context about what's happening to preprocessor variable(s) at a certain place in the code. When something unexpected is happening, logging is the first step to figure out why.

+}

MCCompiled Wiki 1.18.1 Help

Debugging

Sometimes, when working on a project, things don't work as you expect. You may also wish to add guards which make sure that the project can only be compiled if certain things are working as you expect.

MCCompiled has two commands made for debugging and guarding against bugs.

Logging

The $log command accepts any inputs of any amount. It will print the input tokens to the console when compiled, separated by spaces. The log command works just as good with a single string specified, too.

Logging is useful to get context about what's happening to preprocessor variable(s) at a certain place in the code. When something unexpected is happening, logging is the first step to figure out why.

$var numbers 4 6 8 $add numbers 10 $log $numbers -

Assertions

When you make an assumption about what a preprocessor variable will contain in your code, you can reinforce that assumption using assertions. The $assert command takes a compile-time condition, same as the $if command. If the condition doesn't evaluate to true, an error is thrown by the command.

Using assertions is particularly useful in places where it's vital for code not to break if you make a change. Code can break for many reasons, but it's almost always unintentional as a side effect of some other change.

+

Assertions

When you make an assumption about what a preprocessor variable will contain in your code, you can reinforce that assumption using assertions. The $assert command takes a compile-time condition, same as the $if command. If the condition doesn't evaluate to true, an error is thrown by the command.

Using assertions is particularly useful in places where it's vital for code not to break if you make a change. Code can break for many reasons, but it's almost always unintentional as a side effect of some other change.

$var numbers 4 6 8 $add numbers 10 $assert numbers == 14 16 18 -

Based on the code, you would expect the results to be 14, 16, 18, so an assertion is made to reinforce that. Uses of $assert in real code would likely be a little different; restricting numbers to certain bounds, making sure that strings aren't too long, etc...

Larger Assertion Example

The following example shows a snippet of code which makes sure that the input doesn't move the player downwards under any circumstance. By creating this assertion, you guarantee that the player cannot be moved down using this macro.

+

Based on the code, you would expect the results to be 14, 16, 18, so an assertion is made to reinforce that. Uses of $assert in real code would likely be a little different; restricting numbers to certain bounds, making sure that strings aren't too long, etc...

Larger Assertion Example

The following example shows a snippet of code which makes sure that the input doesn't move the player downwards under any circumstance. By creating this assertion, you guarantee that the player cannot be moved down using this macro.

$macro movePlayer x y z { $assert y >= 0 tp @s (~ + $x) (~ + $y) (~ + $z) } -

Throwing Errors

Throwing an error can be useful when something goes terribly wrong, and you need to figure out where it happened. This is done using the throw command, which runs at runtime and fully halts execution. throw supports format-strings.

+

Throwing Errors

Throwing an error can be useful when something goes terribly wrong, and you need to figure out where it happened. This is done using the throw command, which runs at runtime and fully halts execution. throw supports format-strings.

throw "Player {@s} didn't have an id. ({id})" -

Halting Code

If you need your code to stop executing immediately, you can run the halt command. Doing this will generate an infinite loop and force the "function command limit" to kick in and stop execution.

Last modified: 24 April 2024
\ No newline at end of file +

Halting Code

If you need your code to stop executing immediately, you can run the halt command. Doing this will generate an infinite loop and force the "function command limit" to kick in and stop execution.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/dialogue.html b/mccompiled/docs/dialogue.html index c37c6c2..bd51f38 100644 --- a/mccompiled/docs/dialogue.html +++ b/mccompiled/docs/dialogue.html @@ -1,9 +1,9 @@ -Dialogue | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Dialogue

NPC dialogue is always a pain to write; localizing text, creating naming conventions, and then having to connect it with commands elsewhere in your project takes an unusually long amount of time.

MCCompiled contains features for defining, displaying, and running code right out of dialogue, which as a result can be automated using metaprogramming, or automatically localized with localization.

Syntax

The dialogue command is slightly different from the vanilla version of the command; most notably being the addition of dialogue new. This syntax allows you to define a scene.

  • dialogue new <string: scene name> {...}

  • dialogue open <npc> <player> [string: scene name]

  • dialogue change <npc> <string: scene name> [player]

Defining Dialogue Scenes

A page of dialogue is called a "scene" in Minecraft. If you're familiar with writing dialogue, this will immediately ring a bell. Defining dialogue is made to be as easy as possible, and as closely integrated with the language as possible.

Let's begin with the dialogue new subcommand, which defines a new scene. The command must immediately be followed by a block; however, the block does not contain regular statements. Each line in the block must be a valid field followed by a comma.

+}

MCCompiled Wiki 1.18.1 Help

Dialogue

NPC dialogue is always a pain to write; localizing text, creating naming conventions, and then having to connect it with commands elsewhere in your project takes an unusually long amount of time.

MCCompiled contains features for defining, displaying, and running code right out of dialogue, which as a result can be automated using metaprogramming, or automatically localized with localization.

Syntax

The dialogue command is slightly different from the vanilla version of the command; most notably being the addition of dialogue new. This syntax allows you to define a scene.

  • dialogue new <string: scene name> {...}

  • dialogue open <npc> <player> [string: scene name]

  • dialogue change <npc> <string: scene name> [player]

Defining Dialogue Scenes

A page of dialogue is called a "scene" in Minecraft. If you're familiar with writing dialogue, this will immediately ring a bell. Defining dialogue is made to be as easy as possible, and as closely integrated with the language as possible.

Let's begin with the dialogue new subcommand, which defines a new scene. The command must immediately be followed by a block; however, the block does not contain regular statements. Each line in the block must be a valid field followed by a comma.

dialogue new "exampleDialogue" { name: "NPC Name" text: "Why, hello there traveller." @@ -23,9 +23,9 @@ } button: "Goodbye!" {} } -

Forward Declaration...?

Since MCCompiled doesn't yet have two-pass compilation, it was easier to disable validation entirely for dialogue names. This means it's possible to misspell the names of defined dialogue, but it's also possible to use dialogue defined externally, or create circular dialogues.

Available Fields

All text in dialogue fields support localization, if enabled. The fields that can be specified in dialogue definitions are as follows:

NPC Name

Sets the name of the NPC showing this dialogue.

  • name: <string: name>

Text

Sets the text in the dialogue. This field supports placing \n to represent a new-line.

  • text: <string: text>

Event: On Open

The code to run when the dialogue is opened. Supports full MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • onOpen: { ... }

Event: On Close

The code to run when the dialogue is closed. Supports full MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • onClose: { ... }

Button

Adds a button to the dialogue with a name and action to perform when clicked. Supports all MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • button: <string: text> { ... }

Opening/Changing Dialogue

Once dialogue has been defined, it can be applied to an NPC so that it can be displayed when the NPC is interacted with, or shown to a player manually. This is done using the dialogue change and dialogue open subcommands, respectively.

+

Forward Declaration...?

Since MCCompiled doesn't yet have two-pass compilation, it was easier to disable validation entirely for dialogue names. This means it's possible to misspell the names of defined dialogue, but it's also possible to use dialogue defined externally, or create circular dialogues.

Available Fields

All text in dialogue fields support localization, if enabled. The fields that can be specified in dialogue definitions are as follows:

NPC Name

Sets the name of the NPC showing this dialogue.

  • name: <string: name>

Text

Sets the text in the dialogue. This field supports placing \n to represent a new-line.

  • text: <string: text>

Event: On Open

The code to run when the dialogue is opened. Supports full MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • onOpen: { ... }

Event: On Close

The code to run when the dialogue is closed. Supports full MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • onClose: { ... }

Button

Adds a button to the dialogue with a name and action to perform when clicked. Supports all MCCompiled code. The selector @s will refer to the player who ran the dialogue.

  • button: <string: text> { ... }

Opening/Changing Dialogue

Once dialogue has been defined, it can be applied to an NPC so that it can be displayed when the NPC is interacted with, or shown to a player manually. This is done using the dialogue change and dialogue open subcommands, respectively.

dialogue new "abc123" { ... } // same as vanilla! dialogue open @e[type=npc,name=Milton] @s "abc123" -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/extra-compile-options.html b/mccompiled/docs/extra-compile-options.html index f06cf0d..a9cc9cf 100644 --- a/mccompiled/docs/extra-compile-options.html +++ b/mccompiled/docs/extra-compile-options.html @@ -1,9 +1,9 @@ -Extra Compile Options | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Extra Compile Options

There are extra compile options that can control how the project is compiled even further than just "where the files are emitted and how?" The various extra compiler parameters are briefly shown here, and expanded upon further down:

--daemon (-dm)

Watch the input file and recompile it every time it's written to: generally, a save from a text editor.

--debug (-db)

Output detailed information about the compilation process.

--decorate (-dc)

Emits files with "decoration"; extra useful information that helps make the compiled code much more human-readable.

--export_all (-ea)

Exports all functions, regardless if they are used or not.

--nopause (-np)

Don't pause at the end of compilation, close the application immediately.

--variable (-ppv)

Accepts a [name] and [value]. Sets a preprocessor variable.

--clear_cache (-cc)

Clears MCCompiled's temporary cache.

--server

Opens as a language server for the editor to connect to.

--search

Searches for and compiles all files individually in the current and children directories.

Daemon

--daemon (-dm)

Watch the input file and recompile it every time it's written to: generally, a save from a text editor.

The compiler will remain open after each compilation and watch the input file for changes. Every time the file is done being written to, it will re-run the compilation with the same settings. This is useful for getting bare-bones linting with a regular text editor, along with instantly being able to see your changes reflected in the game without having to press any buttons.

Debug

--debug (-db)

Output detailed information about the compilation process.

This isn't generally useful for the end-user unless you like seeing all the inner workings of the compiler as it goes, or are trying to figure out why a compilation is taking a long time. Debug mode will print:

  • All incoming and outgoing WebSocket traffic, if running as a server

  • Project name

  • Results (tokens) after lexical analysis

    • Reconstruction of code based on those tokens

  • All 'statements' assembled from the tokens

  • All 'statements' as they execute and are processed down

    • Such as after compression of an a + b operation to c

  • Compilation time

  • All files being written after compilation

  • Success status (True or False)

Decorate

--decorate (-dc)

Emits files with "decoration"; extra useful information that helps make the compiled code much more human-readable.

Decoration is an infinitely useful option if your final commands are going to be reviewed or debugged by a human manually. Each command is given a comment with the original code (as if it was pseudocode) to better explain what it's doing, and all subfunctions are given comments marking where they were called from and why. If statements are given descriptive comments about what they are checking for, and overall, the entire project is annotated with readability in mind.

Original code, depicting a += b * c
Compiled code decorated to illustrate the subfunction it creates for the b * c operation.

Export All

--export_all (-ea)

Exports all functions, regardless if they are used or not.

In MCCompiled, functions are only emitted if they are used in the source. This makes it possible to include things like libraries without having to incur the overhead of the library's unused functions making it into the final build.

You can use the export attribute to export a single function that needs to be in the final build. "Export All" is just for cases where you want all files no matter what.

No Pause

--nopause (-np)

Don't pause at the end of compilation, close the application immediately.

Tells the application to exit immediately once done compiling, without requiring an extra key press. Recommended if running as part of a script, but not recommended if it is the main command of a script.

Preprocessor Variable

--variable (-ppv)

Accepts a [name] and [value]. Sets a preprocessor variable.

Set a preprocessor variable to a value before compilation starts. This serves as a way of passing in information through external application, batch script, etc. to the preprocessor. The --variable argument can be specified as many times as needed, and follows the format of --variable [name] [value]

Values are only partially parsed, and don't support things like selectors, dereferencing other preprocessor variables, or suffixed integers. Here is a list of supported types as of MCCompiled 1.16, in order of checks:

  • Booleans (case-insensitive)

  • Decimal numbers

  • Integers

  • Strings (fallback)

Clear Cache

--clear_cache (-cc)

Clears MCCompiled's temporary cache.

The cache is located at AppData/Local/.mccompiled. It contains files that track compilation counts, vanilla files, etc... If MCCompiled is outputting files for bindings which are too old, you may consider clearing the cache this way.

Server

--server

Opens as a language server for the editor to connect to.

MCCompiled will open as a language server for communication with the editor. It begins by actively listening for incoming WebSocket connections and then will host the first one that connects. Documentation about the server's protocol is unpublished as of now; The plan eventually is to move over to an LSP implementation instead, for easier integration into existing editors like VSCode or Fleet.

The "server" option does not require a file name, as it completely changes the flow of the application.

--search

Searches for and compiles all files individually in the current and children directories.

The compiler searches for every .mcc file in the current and children directories. Each file is compiled individually, and it is not recommended to try setting project name manually as it may cause every file to collide. Setting location still works normally, as the ?project variable is subbed out for each file's project name.

When used along with the Daemon compile option, the compiler will watch for changes in any .mcc file in the current or children directories, rather than the specified one.

The "search" option does not require a file name, as it completely changes the flow of the application.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Extra Compile Options

There are extra compile options that can control how the project is compiled even further than just "where the files are emitted and how?" The various extra compiler parameters are briefly shown here, and expanded upon further down:

--daemon (-dm)

Watch the input file and recompile it every time it's written to: generally, a save from a text editor.

--debug (-db)

Output detailed information about the compilation process.

--decorate (-dc)

Emits files with "decoration"; extra useful information that helps make the compiled code much more human-readable.

--export_all (-ea)

Exports all functions, regardless if they are used or not.

--nopause (-np)

Don't pause at the end of compilation, close the application immediately.

--variable (-ppv)

Accepts a [name] and [value]. Sets a preprocessor variable.

--clear_cache (-cc)

Clears MCCompiled's temporary cache.

--server

Opens as a language server for the editor to connect to.

--search

Searches for and compiles all files individually in the current and children directories.

--ignore_manifests

Disables the writing of manifest files.

Daemon

--daemon (-dm)

Watch the input file and recompile it every time it's written to: generally, a save from a text editor.

The compiler will remain open after each compilation and watch the input file for changes. Every time the file is done being written to, it will re-run the compilation with the same settings. This is useful for getting bare-bones linting with a regular text editor, along with instantly being able to see your changes reflected in the game without having to press any buttons.

Debug

--debug (-db)

Output detailed information about the compilation process.

This isn't generally useful for the end-user unless you like seeing all the inner workings of the compiler as it goes, or are trying to figure out why a compilation is taking a long time. Debug mode will print:

  • All incoming and outgoing WebSocket traffic, if running as a server

  • Project name

  • Results (tokens) after lexical analysis

    • Reconstruction of code based on those tokens

  • All 'statements' assembled from the tokens

  • All 'statements' as they execute and are processed down

    • Such as after compression of an a + b operation to c

  • Compilation time

  • All files being written after compilation

  • Success status (True or False)

Decorate

--decorate (-dc)

Emits files with "decoration"; extra useful information that helps make the compiled code much more human-readable.

Decoration is an infinitely useful option if your final commands are going to be reviewed or debugged by a human manually. Each command is given a comment with the original code (as if it was pseudocode) to better explain what it's doing, and all subfunctions are given comments marking where they were called from and why. If statements are given descriptive comments about what they are checking for, and overall, the entire project is annotated with readability in mind.

Original code, depicting a += b * c
Compiled code decorated to illustrate the subfunction it creates for the b * c operation.

Export All

--export_all (-ea)

Exports all functions, regardless if they are used or not.

In MCCompiled, functions are only emitted if they are used in the source. This makes it possible to include things like libraries without having to incur the overhead of the library's unused functions making it into the final build.

You can use the export attribute to export a single function that needs to be in the final build. "Export All" is just for cases where you want all files no matter what.

No Pause

--nopause (-np)

Don't pause at the end of compilation, close the application immediately.

Tells the application to exit immediately once done compiling, without requiring an extra key press. Recommended if running as part of a script, but not recommended if it is the main command of a script.

Preprocessor Variable

--variable (-ppv)

Accepts a [name] and [value]. Sets a preprocessor variable.

Set a preprocessor variable to a value before compilation starts. This serves as a way of passing in information through external application, batch script, etc. to the preprocessor. The --variable argument can be specified as many times as needed, and follows the format of --variable [name] [value]

Values are only partially parsed, and don't support things like selectors, dereferencing other preprocessor variables, or suffixed integers. Here is a list of supported types as of MCCompiled 1.16, in order of checks:

  • Booleans (case-insensitive)

  • Decimal numbers

  • Integers

  • Strings (fallback)

Clear Cache

--clear_cache (-cc)

Clears MCCompiled's temporary cache.

The cache is located at AppData/Local/.mccompiled. It contains files that track compilation counts, vanilla files, etc... If MCCompiled is outputting files for bindings which are too old, you may consider clearing the cache this way.

Server

--server

Opens as a language server for the editor to connect to.

MCCompiled will open as a language server for communication with the editor. It begins by actively listening for incoming WebSocket connections and then will host the first one that connects. Documentation about the server's protocol is unpublished as of now; The plan eventually is to move over to an LSP implementation instead, for easier integration into existing editors like VSCode or Fleet.

The "server" option does not require a file name, as it completely changes the flow of the application.

--search

Searches for and compiles all files individually in the current and children directories.

The compiler searches for every .mcc file in the current and children directories. Each file is compiled individually, and it is not recommended to try setting project name manually as it may cause every file to collide. Setting location still works normally, as the ?project variable is subbed out for each file's project name.

When used along with the Daemon compile option, the compiler will watch for changes in any .mcc file in the current or children directories, rather than the specified one.

The "search" option does not require a file name, as it completely changes the flow of the application.

Ignore Manifests

If MCCompiled doesn't support your particular manifest configuration, you can disable the writing of manifests entirely while a fix is worked on. By passing this flag, no manifests (including RP regardless of if it exists) will be written at the end of compilation.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/functions.html b/mccompiled/docs/functions.html index c0922c2..2856234 100644 --- a/mccompiled/docs/functions.html +++ b/mccompiled/docs/functions.html @@ -1,9 +1,9 @@ -Functions | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Functions

Functions work similarly to regular .mcfunctions, but contain extra utility to make them work more like programming functions. At its most basic level, a function can be used to create a new .mcfunction file and place code in it.

Defining Functions

Functions are defined using the function command. The command itself is very dynamic and accepts lots of different kinds of inputs; however, it always requires a function name.

A code block must always follow function definitions. The code in this block is what will go into the defined function.

+}

MCCompiled Wiki 1.18.1 Help

Functions

Functions work similarly to regular .mcfunctions, but contain extra utility to make them work more like programming functions. At its most basic level, a function can be used to create a new .mcfunction file and place code in it.

Defining Functions

Functions are defined using the function command. The command itself is very dynamic and accepts lots of different kinds of inputs; however, it always requires a function name.

A code block must always follow function definitions. The code in this block is what will go into the defined function.

function example { print "Heyo, what's up?" } -

Parameters

Functions can be defined with parameters, which must be specified whenever the function is called. Parameter definitions use the same syntax as values, but without the keyword define. Functions are very flexible with how you can specify parameters, but the most widely accepted way is by placing them inside parentheses () and separating them by commas ,.

The following example shows defining a function called "awardPoints" with a single parameter, being the number of points to award.

+

Parameters

Functions can be defined with parameters, which must be specified whenever the function is called. Parameter definitions use the same syntax as values, but without the keyword define. Functions are very flexible with how you can specify parameters, but the most widely accepted way is by placing them inside parentheses () and separating them by commas ,.

The following example shows defining a function called "awardPoints" with a single parameter, being the number of points to award.

function awardPoints(int amount) { points += amount } -

Optional Parameters

If you want to make a parameter optional, you need to give it a default value that will be specified automatically if it's omitted. This is done using the assignment operator =, and the default value. Once you specify an optional parameter, every parameter that follows must also be optional.

The following example shows the "awardPoints" function with its "amount" parameter optional such that if the caller doesn't specify an amount, it will default to 1.

+

Optional Parameters

If you want to make a parameter optional, you need to give it a default value that will be specified automatically if it's omitted. This is done using the assignment operator =, and the default value. Once you specify an optional parameter, every parameter that follows must also be optional.

The following example shows the "awardPoints" function with its "amount" parameter optional such that if the caller doesn't specify an amount, it will default to 1.

function awardPoints(int amount = 1) { points += amount } -

Using Folders

When defining a function, the dots . in its name act as path separators for the folder it will go in. When the function is exported to an .mcfunction file, it will be placed in the folder. The following example shows creating a function which will be placed in a subfolder:

+

Using Folders

When defining a function, the dots . in its name act as path separators for the folder it will go in. When the function is exported to an .mcfunction file, it will be placed in the folder. The following example shows creating a function which will be placed in a subfolder:

function scoring.reset() { points[*] = 0 } -

The compiled function is then located at scoring/reset.mcfunction. Using folders is a good way to group functions based on what they do, increasing clarity for both the writer of the code and the reader.

Calling Functions

Now that you have functions, you need to be able to use them. Running a function is also known as "calling" it. The syntax of calling a function is functionName(parameters).

If the function doesn't have any parameters (or its parameters are all optional), you still need the parentheses to tell MCCompiled that you want to call the function: functionName()

The following example calls the awardPoints defined in the earlier examples:

+

The compiled function is then located at scoring/reset.mcfunction. Using folders is a good way to group functions based on what they do, increasing clarity for both the writer of the code and the reader.

Calling Functions

Now that you have functions, you need to be able to use them. Running a function is also known as "calling" it. The syntax of calling a function is functionName(parameters).

If the function doesn't have any parameters (or its parameters are all optional), you still need the parentheses to tell MCCompiled that you want to call the function: functionName()

The following example calls the awardPoints defined in the earlier examples:

// award the player with five points awardPoints(5) // award the player with a single point awardPoints() -

Return Values

Functions are able to send back a value after they're done running, called a "return value." Return values are particularly useful in cases where the function is a utility for other code to use.

Returning a Value

To return a value, use the return command. This will set the value that will be returned when the function ends. The return command, as of 1.16, does not stop the function immediately, but this is planned for a future version.

This example shows a more complicated function which computes the highest score of any player in the game and returns it to the caller:

+

Return Values

Functions are able to send back a value after they're done running, called a "return value." Return values are particularly useful in cases where the function is a utility for other code to use.

Returning a Value

To return a value, use the return command. This will set the value that will be returned when the function ends. The return command, as of 1.16, does not stop the function immediately, but this is planned for a future version.

This example shows a more complicated function which computes the highest score of any player in the game and returns it to the caller:

function getHighestPoints { // keep track of the highest number of points so far define global int highestPoints = 0 @@ -49,11 +49,11 @@ // return the value to the caller return highestPoints } -

Type Consistency

If you have a return command somewhere in the function, every return command in that same function must return the same type. If you return a boolean somewhere in the function, you can't return an integer somewhere else.

Using Return Values

Using a return value is done by using the function call as if it were a value. The following example builds on the getHighestPoints example shown above by using its return value. If the function returns more than 100, it's considered an "ultra-high score" and a title is shown to all players.

The title then calls the function again and displays its returned value in the message.

+

Type Consistency

If you have a return command somewhere in the function, every return command in that same function must return the same type. If you return a boolean somewhere in the function, you can't return an integer somewhere else.

Using Return Values

Using a return value is done by using the function call as if it were a value. The following example builds on the getHighestPoints example shown above by using its return value. If the function returns more than 100, it's considered an "ultra-high score" and a title is shown to all players.

The title then calls the function again and displays its returned value in the message.

if getHighestPoints() > 100 { title @a "Achieved an ultra-high score of {getHighestPoints()}!" } -

Exports

When a function is not used anywhere in your code, it is not included in the compiled output unless given the export attribute. So, what constitutes as a function being "used"?

Any code in the top-level of your file, as in, not inside any block is always marked as used. Any function marked for export will propagate that to any of the functions it calls. Any functions marked with the auto attribute are also marked as used.

+

Exports

When a function is not used anywhere in your code, it is not included in the compiled output unless given the export attribute. So, what constitutes as a function being "used"?

Any code in the top-level of your file, as in, not inside any block is always marked as used. Any function marked for export will propagate that to any of the functions it calls. Any functions marked with the auto attribute are also marked as used.

function a() {} function b() { a() @@ -64,25 +64,25 @@ // top level call a() -
  • In this example, only the function a is exported because it's the only one in use.

  • If the top level call is changed to b(), then the functions a and b are both exported.

  • If the top level call is changed to c(), then the functions a, b and c are exported.

Attributes

Attributes can change the way functions behave. Any number of attributes can be applied anywhere before the name. See attributes for all attributes across the language.

extern

Makes a function external. External functions cannot have code in them, and their parameter names are interpreted verbatim. These functions will call the .mcfunction that matches their name and folder, making them great for combining MCCompiled with optimized handwritten functions or code from non-MCCompiled users.

Examples & Use-case

In cases where you have an .mcfunction file that cannot be ported or is not necessary to port over, it's better to declare an external function; making it possible to call the .mcfunction directly.

+
  • In this example, only the function a is exported because it's the only one in use.

  • If the top level call is changed to b(), then the functions a and b are both exported.

  • If the top level call is changed to c(), then the functions a, b and c are exported.

Attributes

Attributes can change the way functions behave. Any number of attributes can be applied anywhere before the name. See attributes for all attributes across the language.

extern

Makes a function external. External functions cannot have code in them, and their parameter names are interpreted verbatim. These functions will call the .mcfunction that matches their name and folder, making them great for combining MCCompiled with optimized handwritten functions or code from non-MCCompiled users.

Examples & Use-case

In cases where you have an .mcfunction file that cannot be ported or is not necessary to port over, it's better to declare an external function; making it possible to call the .mcfunction directly.

// BP/functions/library/example.mcfunction function extern library.example ‎ library.example() -
export

Marks a function for export. The function and any functions it calls will always be exported whether they're in use or not. See more about usage/exports here.

Examples & Use-case

Excluding unused files is beneficial for many projects, but sometimes you'll have functions you run in-game through a command block, the /function command, or other methods MCCompiled doesn't know about. The export attribute covers those edge cases. In this example, the user wants to run /function reset in game.

+
export

Marks a function for export. The function and any functions it calls will always be exported whether they're in use or not. See more about usage/exports here.

Examples & Use-case

Excluding unused files is beneficial for many projects, but sometimes you'll have functions you run in-game through a command block, the /function command, or other methods MCCompiled doesn't know about. The export attribute covers those edge cases. In this example, the user wants to run /function reset in game.

function export reset { kill @e[type=item] itemsCollected[*] = 0 print "Reset everything!" } -
auto

Makes the function automatically run every tick; or, if specified, at an interval. If the attribute is specified as-is, the function will be marked as "in use" and added to tick.json. If a parameter is given in ticks, the function will run on that interval using an auto-generated timer.

Examples & Use-case

Anywhere tick.json is needed, or something needs to happen on a timer, the auto attribute saves lots of boilerplate code and clearly communicates which functions automatically run. In the example below, time suffixes are used instead of tick count.

+
auto

Makes the function automatically run every tick; or, if specified, at an interval. If the attribute is specified as-is, the function will be marked as "in use" and added to tick.json. If a parameter is given in ticks, the function will run on that interval using an auto-generated timer.

Examples & Use-case

Anywhere tick.json is needed, or something needs to happen on a timer, the auto attribute saves lots of boilerplate code and clearly communicates which functions automatically run. In the example below, time suffixes are used instead of tick count.

function auto everyTick { // logic to run every tick. } function auto(1s) everySecond { // logic to run once a second. } -
partial

Makes a function partially implemented. When a function is partial, you can re-define it later as many times as you want, with each one appending its contents to the original function.

Examples & Use-case

Partial functions are useful with metaprogramming or forward declaration, where you may want to use a function before its actual implementation. The following example shows how a function can be defined in two different places with their results merged.

+
partial

Makes a function partially implemented. When a function is partial, you can re-define it later as many times as you want, with each one appending its contents to the original function.

Examples & Use-case

Partial functions are useful with metaprogramming or forward declaration, where you may want to use a function before its actual implementation. The following example shows how a function can be defined in two different places with their results merged.

function partial example { print "One!" } @@ -93,4 +93,4 @@ example() // One! // Two! -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/getting-started.html b/mccompiled/docs/getting-started.html index 254975c..9bc2483 100644 --- a/mccompiled/docs/getting-started.html +++ b/mccompiled/docs/getting-started.html @@ -1,9 +1,9 @@ -Getting Started | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Getting Started

Learning a new tool always takes time, but this guide should help you get up and running with MCCompiled as soon as possible so that you can win back time through using it.

Choice of Editor

There are three primary ways of compiling/running MCCompiled code.

  1. Through the official editor, the recommended choice for most users as of now.

  2. Through command line, which offers more granular control over compilation and output.

  3. Through Regolith, integrated with other various tools.

All of these options have their uses, so it's up to you to decide which fits you best. If you're learning/evaluating MCCompiled, the web editor is the best choice since it's zero effort to get started, and you get to enjoy all the language features out of the box without any setup.

Developers may choose to do a hybrid of the editor and manual compilation via things like build scripts. See here on how to compile code manually through the command line.

Additionally, developers can choose to use the officially supported Regolith filter to use MCCompiled features alongside other community-developed plugins. See here on how to set it up for a project.

What this Guide Will Use

Examples, language, etc. across this documentation will use the official editor to keep everything as clear and easy as possible.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Getting Started

Learning a new tool always takes time, but this guide should help you get up and running with MCCompiled as soon as possible so that you can win back time through using it.

Choice of Editor

There are three primary ways of compiling/running MCCompiled code.

  1. Through the official editor, the recommended choice for most users as of now.

  2. Through command line, which offers more granular control over compilation and output.

  3. Through Regolith, integrated with other various tools.

All of these options have their uses, so it's up to you to decide which fits you best. If you're learning/evaluating MCCompiled, the web editor is the best choice since it's zero effort to get started, and you get to enjoy all the language features out of the box without any setup.

Developers may choose to do a hybrid of the editor and manual compilation via things like build scripts. See here on how to compile code manually through the command line.

Additionally, developers can choose to use the officially supported Regolith filter to use MCCompiled features alongside other community-developed plugins. See here on how to set it up for a project.

What this Guide Will Use

Examples, language, etc. across this documentation will use the official editor to keep everything as clear and easy as possible.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/giving-items.html b/mccompiled/docs/giving-items.html index 54a6ae0..71de62c 100644 --- a/mccompiled/docs/giving-items.html +++ b/mccompiled/docs/giving-items.html @@ -1,9 +1,9 @@ -Giving Items | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Giving Items

The give command in MCCompiled is almost syntactically the same as Minecraft's default give command:

  • give <selector> <item> [count] [data]

However, the command contains numerous extra features which make it immensely more useful than the Minecraft command.

Attributes

After the regular arguments of the give command, you can specify as many attributes as you would like. Attributes change the item that will be given in different ways. An example showing how this may look is shown below:

+}

MCCompiled Wiki 1.18.1 Help

Giving Items

The give command in MCCompiled is almost syntactically the same as Minecraft's default give command:

  • give <selector> <item> [count] [data]

However, the command contains numerous extra features which make it immensely more useful than the Minecraft command.

Attributes

After the regular arguments of the give command, you can specify as many attributes as you would like. Attributes change the item that will be given in different ways. An example showing how this may look is shown below:

give @s diamond_pickaxe keep candestroy: "diamond_block" -

Including Attributes on New Lines

When using lots of attributes, give commands can get really long. You can specify attributes on new lines to keep everything shorter and better formatted. In the following example, a sweet sword is created using multiple of the attributes in this page:

+

Including Attributes on New Lines

When using lots of attributes, give commands can get really long. You can specify attributes on new lines to keep everything shorter and better formatted. In the following example, a sweet sword is created using multiple of the attributes in this page:

give @s netherite_sword 1 keep enchant: sharpness 5 enchant: unbreaking 3 name: "Hyper Sword" lore: "A legendary sword." -

Vanilla Attributes

Let's begin with the attributes which are supported in vanilla Minecraft, using JSON components.

Keep on Death

The item will be kept in the player's inventory, even after they die.

  • keep

Lock in Inventory

The item will be locked in the player's inventory. They will be unable to drop it, craft with it, etc. but it will not be constrained to any specific slot.

  • lockinventory

Lock in Slot

The item will be locked in the player's inventory, same as above, but it will be unable to be moved from the slot it's placed in, too.

  • lockslot

Can Place on Block

Specifies a block which the given item can be placed on in adventure mode (2).

  • canplaceon: <block>

Can Destroy Block

Specifies a block which the given item can break in adventure mode (2).

  • candestroy: <block>

Extended Attributes

When an extended attribute is used, the give command will be internally changed over to a structure load command, and a structure will be generated containing the item. The advantage of doing this is that you can access to a whole world of attributes that are not possible in the current Minecraft command system.

Enchant Item

Adds the given enchantment to the item. It has no constraints on enchantment level. This attribute can be repeated to add more enchantments to the same item.

  • enchant: <enchantment> <level>

Item Name

Sets the display name of the item. Does not support format-strings or localization.

  • name: <text>

Item Lore

Adds a line of lore to the item; extra text that is displayed when hovering over/selecting it. This attribute can be repeated to add more lines of lore to the item. Does not support format-strings or localization.

  • lore: <text>

Book-Specific Attributes

If the item you're giving is a written_book, you can use the following attributes:

Book Title

Sets the title of the book, which is also the item's name when held. Does not support format-strings or localization.

  • title: <text>

Book Author

Sets the author of the book. Does not support format-strings or localization.

  • author: <text>

Add Page

Adds a page with the given text to the book. This attribute can be repeated to add more pages to the book. Does not support format-strings or localization.

  • page: <text>

Leather-Specific Attributes

If the item is a leather item (armor, horse armor, etc.), you can use the dye attribute:

Dye Leather

Sets the color of the leather item to the given red, green, and blue color. These numbers range from 0 to 255.

  • dye: 255 0 120

Last modified: 24 April 2024
\ No newline at end of file +

Vanilla Attributes

Let's begin with the attributes which are supported in vanilla Minecraft, using JSON components.

Keep on Death

The item will be kept in the player's inventory, even after they die.

  • keep

Lock in Inventory

The item will be locked in the player's inventory. They will be unable to drop it, craft with it, etc. but it will not be constrained to any specific slot.

  • lockinventory

Lock in Slot

The item will be locked in the player's inventory, same as above, but it will be unable to be moved from the slot it's placed in, too.

  • lockslot

Can Place on Block

Specifies a block which the given item can be placed on in adventure mode (2).

  • canplaceon: <block>

Can Destroy Block

Specifies a block which the given item can break in adventure mode (2).

  • candestroy: <block>

Extended Attributes

When an extended attribute is used, the give command will be internally changed over to a structure load command, and a structure will be generated containing the item. The advantage of doing this is that you can access to a whole world of attributes that are not possible in the current Minecraft command system.

Enchant Item

Adds the given enchantment to the item. It has no constraints on enchantment level. This attribute can be repeated to add more enchantments to the same item.

  • enchant: <enchantment> <level>

Item Name

Sets the display name of the item. Does not support format-strings or localization.

  • name: <text>

Item Lore

Adds a line of lore to the item; extra text that is displayed when hovering over/selecting it. This attribute can be repeated to add more lines of lore to the item. Does not support format-strings or localization.

  • lore: <text>

Book-Specific Attributes

If the item you're giving is a written_book, you can use the following attributes:

Book Title

Sets the title of the book, which is also the item's name when held. Does not support format-strings or localization.

  • title: <text>

Book Author

Sets the author of the book. Does not support format-strings or localization.

  • author: <text>

Add Page

Adds a page with the given text to the book. This attribute can be repeated to add more pages to the book. Does not support format-strings or localization.

  • page: <text>

Leather-Specific Attributes

If the item is a leather item (armor, horse armor, etc.), you can use the dye attribute:

Dye Leather

Sets the color of the leather item to the given red, green, and blue color. These numbers range from 0 to 255.

  • dye: 255 0 120

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/hello-world.html b/mccompiled/docs/hello-world.html index c47366c..37b77e0 100644 --- a/mccompiled/docs/hello-world.html +++ b/mccompiled/docs/hello-world.html @@ -1,9 +1,9 @@ -Hello, World! | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Hello, World!

Once you have installed MCCompiled, it's time to get something compiled and running.

Creating a Project

Projects in MCCompiled are just .mcc files. These files can include other files, and that determines the project's structure. When compiling, you always want to compile the root file.

To begin, create a file called first_project.mcc

Opening in the Web Editor

Open the Web Editor in your browser

The first step is to get an instance of the server running on your system. Press "CONNECT" to attempt to connect to one. If there is no server running, you will be prompted if you would like to open one. Pressing "YES" will open a new MCCompiled server on your system. Now, when you press "CONNECT," the editor should connect to it. Congratulations, you now have live errors and compilation!

Video showing how to launch and connect to a language server in the editor.

Opening Project

You can press the "OPEN" button in the editor to open an existing .mcc file as a project. Try pressing the button and choosing your newly created first_project.mcc file. It will open in the editor, but it's currently empty. At this point, you can now do a couple of things:

  1. Change the project name in an editable field under "PROJECT NAME."

  2. Change the project settings by pressing the gear icon.

Your project name and settings are saved automatically inside the .mcc file as comments at the top of the file. Because of this, your settings can be restored later if you re-open the same project.

Writing the Code

Let's make a simple /tellraw statement that says hello to the player that runs it. MCCompiled has the command print which builds a tellraw to display to @s. The print command accepts a string as an input, which is denoted using "quotation marks" or 'single quotes.' It's down to preference.

+}

MCCompiled Wiki 1.18.1 Help

Hello, World!

Once you have installed MCCompiled, it's time to get something compiled and running.

Creating a Project

Projects in MCCompiled are just .mcc files. These files can include other files, and that determines the project's structure. When compiling, you always want to compile the root file.

To begin, create a file called first_project.mcc

Opening in the Web Editor

Open the Web Editor in your browser

The first step is to get an instance of the server running on your system. Press "CONNECT" to attempt to connect to one. If there is no server running, you will be prompted if you would like to open one. Pressing "YES" will open a new MCCompiled server on your system. Now, when you press "CONNECT," the editor should connect to it. Congratulations, you now have live errors and compilation!

Video showing how to launch and connect to a language server in the editor.

Opening Project

You can press the "OPEN" button in the editor to open an existing .mcc file as a project. Try pressing the button and choosing your newly created first_project.mcc file. It will open in the editor, but it's currently empty. At this point, you can now do a couple of things:

  1. Change the project name in an editable field under "PROJECT NAME."

  2. Change the project settings by pressing the gear icon.

Your project name and settings are saved automatically inside the .mcc file as comments at the top of the file. Because of this, your settings can be restored later if you re-open the same project.

Writing the Code

Let's make a simple /tellraw statement that says hello to the player that runs it. MCCompiled has the command print which builds a tellraw to display to @s. The print command accepts a string as an input, which is denoted using "quotation marks" or 'single quotes.' It's down to preference.

print "Hello, {@s}!" -

This particular example is using string interpolation to insert the name of @s, or the executing player. Interpolation can include things like selectors, variable names, or even full expressions. An interpolated item is surrounded with \{curly braces.}

As seen in the example, the selector @s is surrounded with {} to denote that it should be interpolated: {@s}. You could also do something more complicated, like {@e[type=cow]}

Compiling the Code

Compiling the code in the editor is as simple as pressing the big "COMPILE" button at the top. Compilation in MCCompiled is extremely fast, so in most cases you will see "Compilation completed" in the top-right immediately. Upon compiling, there will be a new behavior pack created in your Minecraft development folders in the format [project name]_BP.

... and running it

At this point, you are clear to open Minecraft, add the pack into your world, and run /function [project name]. By default, any top level statements are placed in a file named after the project.

What's the 'init' function about?

While looking through the emitted files, You may also notice an init function in the output. This file will contain any initialization code that should only run once per world, and thus is pulled away from the rest of the regular code. Things like defining scoreboard objectives are placed there rather than in the source files, as it wastes part of the precious 10,000-command limit.

A pitfall of this optimization is that sometimes this function needs to be re-run when the project expands. The project doesn't only expand when new variables are added, either. MCCompiled also creates and manages temporary variables to assist with inline operations, function parameters, return values, timers, and preparing objectives to be displayed in rawtext. If you are experiencing an unexpected issue with your code, re-running the init file may be the solution.

Done!

You've successfully compiled and run your first project in MCCompiled using the editor! The next logical step would be to continue exploring language features and commands.

Head into the fundamentals category to begin exploring the language's features, or go to the cheat sheet to see everything all in one place.

Last modified: 24 April 2024
\ No newline at end of file +

This particular example is using string interpolation to insert the name of @s, or the executing player. Interpolation can include things like selectors, variable names, or even full expressions. An interpolated item is surrounded with \{curly braces.}

As seen in the example, the selector @s is surrounded with {} to denote that it should be interpolated: {@s}. You could also do something more complicated, like {@e[type=cow]}

Compiling the Code

Compiling the code in the editor is as simple as pressing the big "COMPILE" button at the top. Compilation in MCCompiled is extremely fast, so in most cases you will see "Compilation completed" in the top-right immediately. Upon compiling, there will be a new behavior pack created in your Minecraft development folders in the format [project name]_BP.

... and running it

At this point, you are clear to open Minecraft, add the pack into your world, and run /function [project name]. By default, any top level statements are placed in a file named after the project.

What's the 'init' function about?

While looking through the emitted files, You may also notice an init function in the output. This file will contain any initialization code that should only run once per world, and thus is pulled away from the rest of the regular code. Things like defining scoreboard objectives are placed there rather than in the source files, as it wastes part of the precious 10,000-command limit.

A pitfall of this optimization is that sometimes this function needs to be re-run when the project expands. The project doesn't only expand when new variables are added, either. MCCompiled also creates and manages temporary variables to assist with inline operations, function parameters, return values, timers, and preparing objectives to be displayed in rawtext. If you are experiencing an unexpected issue with your code, re-running the init file may be the solution.

Done!

You've successfully compiled and run your first project in MCCompiled using the editor! The next logical step would be to continue exploring language features and commands.

Head into the fundamentals category to begin exploring the language's features, or go to the cheat sheet to see everything all in one place.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/including-other-files.html b/mccompiled/docs/including-other-files.html index a129ca0..a2243fc 100644 --- a/mccompiled/docs/including-other-files.html +++ b/mccompiled/docs/including-other-files.html @@ -1,9 +1,9 @@ -Including Other Files | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Including Other Files

Developing projects with multiple files is a universally good way to separate parts of code. MCCompiled has shallow support for multi-file development using the $include command.

The $include command loads and processes the input file on the spot; it's effectively the same as if you had placed the file's source code in place of the command.

Example

The syntax of the $include command is $include <string: file>. The following example shows defining a function in one file, and then calling it in the main file. The structure of the example looks like this:

  • ./resources/

    • lib.mcc

  • main.mcc

lib.mcc

+}

MCCompiled Wiki 1.18.1 Help

Including Other Files

Developing projects with multiple files is a universally good way to separate parts of code. MCCompiled has shallow support for multi-file development using the $include command.

The $include command loads and processes the input file on the spot; it's effectively the same as if you had placed the file's source code in place of the command.

Example

The syntax of the $include command is $include <string: file>. The following example shows defining a function in one file, and then calling it in the main file. The structure of the example looks like this:

  • ./resources/

    • lib.mcc

  • main.mcc

lib.mcc

// returns the absolute value of the given number function abs(int n) { if n < 0 @@ -29,6 +29,6 @@ define a = -30 define b = abs(a) print "Absolute value of {a} is {b}" -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/indexing.html b/mccompiled/docs/indexing.html index 7e81ea1..4610d03 100644 --- a/mccompiled/docs/indexing.html +++ b/mccompiled/docs/indexing.html @@ -1,9 +1,9 @@ -Indexing | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Indexing

Indexers are sets of tokens placed inside square brackets []. Its purpose is to pull an element from an array, or to change who (or what) a value points to, called "clarifying."

Simple Indexing

Various types of objects support indexing. Examples are provided under each.

String Literals

String literals can be indexed by number, resulting in the character at the given index. If you index the string with a range, a substring will be returned (inclusive).

Unbounded ranges will return the rest of the string, allowing you to get substrings without having to calculate any lengths.

+}

MCCompiled Wiki 1.18.1 Help

Indexing

Indexers are sets of tokens placed inside square brackets []. Its purpose is to pull an element from an array, or to change who (or what) a value points to, called "clarifying."

Simple Indexing

Various types of objects support indexing. Examples are provided under each.

String Literals

String literals can be indexed by number, resulting in the character at the given index. If you index the string with a range, a substring will be returned (inclusive).

Unbounded ranges will return the rest of the string, allowing you to get substrings without having to calculate any lengths.

$var text "Hello, World!" $assert $text[4] == 'o' $assert $text[7..11] == 'World' $assert $text[7..] == 'World!' $assert $text[..5] == 'Hello,' -
Ranges

You can index a range by either using (0, min or minimum) or (1, max or maximum) to get either element of it respectively.

Specifying (2 or inverted) returns a boolean identifying if the range is inverted.

+
Ranges

You can index a range by either using (0, min or minimum) or (1, max or maximum) to get either element of it respectively.

Specifying (2 or inverted) returns a boolean identifying if the range is inverted.

$var zone 5..10 $assert $zone['min'] == 5 $assert $zone['max'] == 10 $assert $zone['inverted'] == false -
JSON

Indexing JSON is handled differently depending on what the JSON object is. If it's an object (with properties), it can only be indexed using a string, being the property name. If it's a JSON array, it can only be indexed using an integer, being the index of the item to retrieve.

See examples, and more about indexing JSON here.

Preprocessor Variables

An alternative way to dereference a preprocessor variable is using an indexer. When indexing a preprocessor variable, you pull an object at a specific index and dereference it.

+
JSON

Indexing JSON is handled differently depending on what the JSON object is. If it's an object (with properties), it can only be indexed using a string, being the property name. If it's a JSON array, it can only be indexed using an integer, being the index of the item to retrieve.

See examples, and more about indexing JSON here.

Preprocessor Variables

An alternative way to dereference a preprocessor variable is using an indexer. When indexing a preprocessor variable, you pull an object at a specific index and dereference it.

$var names "pig" "cow" "sheep" $assert names[0] == "pig" $assert names[2] == "sheep" $assert names[1] == "cow" -

Clarifying

In some cases, you might need to assign a value to specific entities, rather than the executing entity @s. In this case, you can use clarification to change who the assignment targets.

The gist of clarification is that you can index a value using a selector to change who it points to. See the following example, which sets the value of all players to 60:

+

Clarifying

In some cases, you might need to assign a value to specific entities, rather than the executing entity @s. In this case, you can use clarification to change who the assignment targets.

The gist of clarification is that you can index a value using a selector to change who it points to. See the following example, which sets the value of all players to 60:

define time timeRemaining timeRemaining[@a] = 60s -

A full section is dedicated to how to use clarification here.

Last modified: 24 April 2024
\ No newline at end of file +

A full section is dedicated to how to use clarification here.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/installation.html b/mccompiled/docs/installation.html index 9c828c1..432d009 100644 --- a/mccompiled/docs/installation.html +++ b/mccompiled/docs/installation.html @@ -1,9 +1,9 @@ -Installation | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Installation

Let's get started by installing MCCompiled using the installer. The installer can perform installation, uninstallation, and updates with a single click.

See Manual Installation if you prefer not to download the installer.

Download

Download the latest installer release here and unzip the files into the directory of your choice.

Running

If MCCompiled is detected to already be installed on your system (looking for mc-compiled in the PATH variable), its version will show up, and you will be given the option to uninstall or update. If MCCompiled is not installed, you will be able to install it.

If MCCompiled is not yet installed, you will have a single "INSTALL" button. MCCompiled 1.18 will be installed into the current user's LocalAppData folder (or if updating, the original location).

Screenshot of the MCCompiled installer.

Testing

Open a command line window and run mc-compiled --version to make sure it's properly installed. If not, make sure to restart all instances of the terminal and/or restart your computer.

First Project

It's time to get your first project up and running. See here on how to begin.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Installation

Let's get started by installing MCCompiled using the installer. The installer can perform installation, uninstallation, and updates with a single click.

See Manual Installation if you prefer not to download the installer.

Download

Download the latest installer release here and unzip the files into the directory of your choice.

Running

If MCCompiled is detected to already be installed on your system (looking for mc-compiled in the PATH variable), its version will show up, and you will be given the option to uninstall or update. If MCCompiled is not installed, you will be able to install it.

If MCCompiled is not yet installed, you will have a single "INSTALL" button. MCCompiled 1.18.1 will be installed into the current user's LocalAppData folder (or if updating, the original location).

Screenshot of the MCCompiled installer.

Testing

Open a command line window and run mc-compiled --version to make sure it's properly installed. If not, make sure to restart all instances of the terminal and/or restart your computer.

First Project

It's time to get your first project up and running. See here on how to begin.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/json-processing.html b/mccompiled/docs/json-processing.html index d53d6f0..6b5c8c2 100644 --- a/mccompiled/docs/json-processing.html +++ b/mccompiled/docs/json-processing.html @@ -1,9 +1,9 @@ -JSON Processing | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

JSON Processing

When you need to access bigger or more complex sets of data that don't make sense to store in the source code, or co-processing with the output from other applications, JSON has you covered. MCCompiled features support for simple JSON processing and data traversal using a simple feature-set.

Loading JSON

Getting the JSON file into your project requires using the $json command. The simplest syntax available is $json [file] [result], where file is the file to load, and result is the preprocessor variable identifier to store the JSON in.

+}

MCCompiled Wiki 1.18.1 Help

JSON Processing

When you need to access bigger or more complex sets of data that don't make sense to store in the source code, or co-processing with the output from other applications, JSON has you covered. MCCompiled features support for simple JSON processing and data traversal using a simple feature-set.

Loading JSON

Getting the JSON file into your project requires using the $json command. The simplest syntax available is $json [file] [result], where file is the file to load, and result is the preprocessor variable identifier to store the JSON in.

$json "resources/data.json" stuff -

Specifying Load Path

There is an optional parameter at the end of the $json command called "path." The path tells MCCompiled where to traverse the JSON before loading it into the preprocessor variable. As an example, take the following JSON file:

+

Specifying Load Path

There is an optional parameter at the end of the $json command called "path." The path tells MCCompiled where to traverse the JSON before loading it into the preprocessor variable. As an example, take the following JSON file:

{ "version": 4, "data": { @@ -37,21 +37,21 @@ ] } } -

If you didn't care about the version, and just wanted to access the object "data," then using a path would make sense.

Path Format

Paths are basic and lax by design. A path is a string made up of "elements," separated by either a period . or either type of slash: / or \. Each element in a path denotes where next to traverse the JSON. If you encounter a JSON array, you need to specify an integer rather than a string.

With the example text above, to fetch the element "data" you would specify the path:

+

If you didn't care about the version, and just wanted to access the object "data," then using a path would make sense.

Path Format

Paths are basic and lax by design. A path is a string made up of "elements," separated by either a period . or either type of slash: / or \. Each element in a path denotes where next to traverse the JSON. If you encounter a JSON array, you need to specify an integer rather than a string.

With the example text above, to fetch the element "data" you would specify the path:

$json "resources/data.json" stuff "data" -

To get the first element of "owners":

+

To get the first element of "owners":

$json "resources/data.json" stuff "data/owners/0" -

Indexing JSON

Now that you have loaded the JSON, you have a preprocessor variable containing either a JSON object or array. From here, you are free to index this JSON further or dereference the preprocessor variable to inlay the data in your code, just like a regular preprocessor variable.

Indexing is done using the regular index operator. Most importantly, an indexing operation must start with a $ to indicate that you wish to dereference and then index the result. Without a dereference, indexing a preprocessor variable will just return an element of it.

+

Indexing JSON

Now that you have loaded the JSON, you have a preprocessor variable containing either a JSON object or array. From here, you are free to index this JSON further or dereference the preprocessor variable to inlay the data in your code, just like a regular preprocessor variable.

Indexing is done using the regular index operator. Most importantly, an indexing operation must start with a $ to indicate that you wish to dereference and then index the result. Without a dereference, indexing a preprocessor variable will just return an element of it.

$json "resources/data.json" stuff "data" tp @a $stuff["coordinates"] -

Chaining Indexers

You can also chain indexers together (still only requiring dereferencing at the start) to traverse the JSON more than one step at a time. Consider the example above, but without using a path when loading it.

+

Chaining Indexers

You can also chain indexers together (still only requiring dereferencing at the start) to traverse the JSON more than one step at a time. Consider the example above, but without using a path when loading it.

$json "resources/data.json" stuff tp @a $stuff["data"]["coordinates"] -

Indexing Arrays

When indexing a JSON array, it must be indexed using an integer, since there are no named keys to go off. Integers must be specified without quotation marks, as with the rest of the language.

+

Indexing Arrays

When indexing a JSON array, it must be indexed using an integer, since there are no named keys to go off. Integers must be specified without quotation marks, as with the rest of the language.

$json "resources/data.json" stuff "data" $var name $stuff["owners"][2]["name"] print "$name has joined!" -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/language.html b/mccompiled/docs/language.html index 13da9d3..551c28a 100644 --- a/mccompiled/docs/language.html +++ b/mccompiled/docs/language.html @@ -1,9 +1,9 @@ -Language | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Language

MCCompiled has a lot of features. Hopefully most of them are documented here, along with guides make them easy to understand and begin using. MCCompiled features can be primarily split into two categories:

  1. Runtime

  2. Compile-time (preprocessor)

Runtime refers to the runtime features of the language, such as types, functions, variables (values), and so much more. If you're studying the language for the first time, it may be more beneficial to start with the runtime features of the language before diving into the preprocessor.

The Preprocessor refers to all types of code that can be run at compile time. There are many features that can be used to generate runtime code, automate parts of the generation, and data-drive your projects using JSON.

What's the Difference?

Compile-time actions always happen while the program is compiled, meaning nothing compile-time happens at runtime. This principle is mutually exclusive; no runtime actions will run during compile-time, either.

As a result, there is a clear distinction made between which category all code falls into. Everything under runtime will always run in-game, and everything under preprocessor will run during compile-time.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Language

MCCompiled has a lot of features. Hopefully most of them are documented here, along with guides make them easy to understand and begin using. MCCompiled features can be primarily split into two categories:

  1. Runtime

  2. Compile-time (preprocessor)

Runtime refers to the runtime features of the language, such as types, functions, variables (values), and so much more. If you're studying the language for the first time, it may be more beneficial to start with the runtime features of the language before diving into the preprocessor.

The Preprocessor refers to all types of code that can be run at compile time. There are many features that can be used to generate runtime code, automate parts of the generation, and data-drive your projects using JSON.

What's the Difference?

Compile-time actions always happen while the program is compiled, meaning nothing compile-time happens at runtime. This principle is mutually exclusive; no runtime actions will run during compile-time, either.

As a result, there is a clear distinction made between which category all code falls into. Everything under runtime will always run in-game, and everything under preprocessor will run during compile-time.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/localization.html b/mccompiled/docs/localization.html index de39eab..e58cac2 100644 --- a/mccompiled/docs/localization.html +++ b/mccompiled/docs/localization.html @@ -1,9 +1,9 @@ -Localization | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Localization

When writing code that is going to be deployed to more than one language, it's necessary to use a .lang file to hold the keys/values for all pieces of text that show up in the project. MCCompiled offers support for automatically generating .lang files and insetting keys into the compiled result.

Setting Up

By default, strings are embedded everywhere in the compiled output. To set up localization, use the lang command. The command accepts an identifier or string, being the locale to default to. If your project is written in English, use en_US, for example.

It's recommended to place the command at the top of your file so that everything applies. If you're creating a library file for others to use, it's not recommended to use lang at all.

+}

MCCompiled Wiki 1.18.1 Help

Localization

When writing code that is going to be deployed to more than one language, it's necessary to use a .lang file to hold the keys/values for all pieces of text that show up in the project. MCCompiled offers support for automatically generating .lang files and insetting keys into the compiled result.

Setting Up

By default, strings are embedded everywhere in the compiled output. To set up localization, use the lang command. The command accepts an identifier or string, being the locale to default to. If your project is written in English, use en_US, for example.

It's recommended to place the command at the top of your file so that everything applies. If you're creating a library file for others to use, it's not recommended to use lang at all.

lang en_US -

What Uses Localization?

Once localization is enabled for a given language, you need an expectation of what will be in the .lang file once the project compiles. Anything that supports raw-text will use translation; take commands like print or actionbar.

When a value is displayed that uses text, such as with booleans, its entries will also be added to the lang file.

Merging Keys

When two or more lang file entries contain the same text, it's possible to merge them into one. By default, this behavior is enabled. Whether to merge or not is controlled by the _lang_merge preprocessor variable, containing a boolean true/false value. If _lang_merge is false, language entries will not be merged.

+

What Uses Localization?

Once localization is enabled for a given language, you need an expectation of what will be in the .lang file once the project compiles. Anything that supports raw-text will use translation; take commands like print or actionbar.

When a value is displayed that uses text, such as with booleans, its entries will also be added to the lang file.

Merging Keys

When two or more lang file entries contain the same text, it's possible to merge them into one. By default, this behavior is enabled. Whether to merge or not is controlled by the _lang_merge preprocessor variable, containing a boolean true/false value. If _lang_merge is false, language entries will not be merged.

// enable lang file merging (default) $var _lang_merge true // disable lang file merging $var _lang_merge false -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/loops.html b/mccompiled/docs/loops.html index 6c211a3..23e214a 100644 --- a/mccompiled/docs/loops.html +++ b/mccompiled/docs/loops.html @@ -1,9 +1,9 @@ -Loops | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Loops

When you need to do something multiple times in commands, the traditional option is to create a function and call it recursively. MCComplied offers three run-time commands that enable you to repeat code conditionally without having to touch function recursion, counters, etc.

All of these commands should be followed by either a code block, or a single statement. That will be the code that runs for each iteration of the loop.

Repeating N times

To repeat code a given number of times, use the repeat command. The repeat command takes in either an integer or another value, indicating how many times to repeat the code.

In the following example, the repeat command is used to kill 10 random cows in the world.

+}

MCCompiled Wiki 1.18.1 Help

Loops

When you need to do something multiple times in commands, the traditional option is to create a function and call it recursively. MCComplied offers three run-time commands that enable you to repeat code conditionally without having to touch function recursion, counters, etc.

All of these commands should be followed by either a code block, or a single statement. That will be the code that runs for each iteration of the loop.

Repeating N times

To repeat code a given number of times, use the repeat command. The repeat command takes in either an integer or another value, indicating how many times to repeat the code.

In the following example, the repeat command is used to kill 10 random cows in the world.

repeat 10 { kill @r[type=cow] } -

Repeating on a value

You can also specify an existing runtime value as the repeat command's argument. The value will be converted to an int if it's not already. This example is the same as above, but uses the value 'prune' as the count instead.

+

Repeating on a value

You can also specify an existing runtime value as the repeat command's argument. The value will be converted to an int if it's not already. This example is the same as above, but uses the value 'prune' as the count instead.

define prune = 10 repeat prune { kill @r[type=cow] } -

Accessing the current iteration

Either variant of the repeat command supports an additional argument, being the name of the value that should hold the current iteration. If one doesn't yet exist, a new global int value is created with the given name.

Current iteration bounds

When using the 'current iteration' value, it will begin at i - 1 where i is the number of repetitions. It will then count down to zero (inclusive). If the current iteration is 0, you know it is the last iteration in the loop. To illustrate, this is the output of using:

+

Accessing the current iteration

Either variant of the repeat command supports an additional argument, being the name of the value that should hold the current iteration. If one doesn't yet exist, a new global int value is created with the given name.

Current iteration bounds

When using the 'current iteration' value, it will begin at i - 1 where i is the number of repetitions. It will then count down to zero (inclusive). If the current iteration is 0, you know it is the last iteration in the loop. To illustrate, this is the output of using:

repeat 10 val { print "Number: {val}" } @@ -38,16 +38,16 @@ Number: 2 Number: 1 Number: 0 -

Repeating while a condition is true

The while command allows you to repeat code as long as a condition remains true. The conditions supported in the while command are exactly the same as with regular if-statements.

The following kills random cows while there are more than 3 remaining:

+

Repeating while a condition is true

The while command allows you to repeat code as long as a condition remains true. The conditions supported in the while command are exactly the same as with regular if-statements.

The following kills random cows while there are more than 3 remaining:

while count @e[type=cow] > 3 { kill @r[type=cow] } -

Repeating over a selector

The for command allows you to concisely iterate over every entity that matches a selector.

+

Repeating over a selector

The for command allows you to concisely iterate over every entity that matches a selector.

for @e[type=cow] { say "Moo" } -

Offsetting position

If you wish to offset the position of the execution (similarly to using the positioned subcommand in execute), you can use the at keyword after specifying the selector. This will allow you to offset the execution position.

The position is applied after being aligned to the executing entity, so facing coordinates like ^1 will be aligned properly.

+

Offsetting position

If you wish to offset the position of the execution (similarly to using the positioned subcommand in execute), you can use the at keyword after specifying the selector. This will allow you to offset the execution position.

The position is applied after being aligned to the executing entity, so facing coordinates like ^1 will be aligned properly.

for @e[type=cow] at ~ ~10 ~ { summon tnt } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/macros.html b/mccompiled/docs/macros.html index 9081b52..a4d08e0 100644 --- a/mccompiled/docs/macros.html +++ b/mccompiled/docs/macros.html @@ -1,9 +1,9 @@ -Macros | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Macros

Macros are the biggest driver of automation in MCCompiled by parameterizing repeated code. It sounds complicated, but is implemented in a way that makes it easy.

The $macro command is used for both defining and calling them, and the syntax is the same for both cases: $macro [name] [args...]

Defining a Macro

If the macro command is followed up with a block, it will be interpreted as a definition. The simplest macro definition, without any arguments, looks like this:

+}

MCCompiled Wiki 1.18.1 Help

Macros

Macros are the biggest driver of automation in MCCompiled by parameterizing repeated code. It sounds complicated, but is implemented in a way that makes it easy.

The $macro command is used for both defining and calling them, and the syntax is the same for both cases: $macro [name] [args...]

Defining a Macro

If the macro command is followed up with a block, it will be interpreted as a definition. The simplest macro definition, without any arguments, looks like this:

$macro exampleMacro { // ...code here... } -

Using Arguments

If you define your macro with arguments, the names of those arguments will be used as preprocessor variable names. Anything that calls the macro will be required to specify a value that will be assigned to its correlated variable.

The following example shows the use of a macro argument message in its contents:

+

Using Arguments

If you define your macro with arguments, the names of those arguments will be used as preprocessor variable names. Anything that calls the macro will be required to specify a value that will be assigned to its correlated variable.

The following example shows the use of a macro argument message in its contents:

$macro showWarning message { print "[!] Warning: $message" } -

Calling a Macro

After a macro is defined, it can be re-used however many times it's needed. The syntax for calling a macro is the same as defining one, except that it's not followed by a block and the input arguments are the values for the parameters rather than their names.

When you call a macro, its contents are run essentially "pasted" with its arguments set to whatever the inputs you gave were. Adding onto the last example, let's add two statements which call the macro with different texts.

+

Calling a Macro

After a macro is defined, it can be re-used however many times it's needed. The syntax for calling a macro is the same as defining one, except that it's not followed by a block and the input arguments are the values for the parameters rather than their names.

When you call a macro, its contents are run essentially "pasted" with its arguments set to whatever the inputs you gave were. Adding onto the last example, let's add two statements which call the macro with different texts.

$macro showWarning message { print "[!] Warning: $message" } $macro showWarning "Winds are high!" $macro showWarning "Get inside!" -

The two macro calls are at the bottom. A summary of what happens is as follows:

  • Set preprocessor variable message to "Winds are high!"

    • Create a print command containing "[!] Warning: $message"

  • Set preprocessor variable message to "Get inside!"

    • Create a print command containing "[!] Warning: $message"

These two macro calls run exactly equivalent to:

+

The two macro calls are at the bottom. A summary of what happens is as follows:

  • Set preprocessor variable message to "Winds are high!"

    • Create a print command containing "[!] Warning: $message"

  • Set preprocessor variable message to "Get inside!"

    • Create a print command containing "[!] Warning: $message"

These two macro calls run exactly equivalent to:

print "[!] Warning: Winds are high!" print "[!] Warning: Get inside!" -

Why use Macros?

Macros can contain as much code as you want, so while there isn't too much benefit to using them in this example, there are unlimited cases where macros save lots of code space and time. See the following two examples from other places in this documentation where macros are illustrated:

This example uses $assert to add bounds-checking to the input y.

+

Why use Macros?

Macros can contain as much code as you want, so while there isn't too much benefit to using them in this example, there are unlimited cases where macros save lots of code space and time. See the following two examples from other places in this documentation where macros are illustrated:

This example uses $assert to add bounds-checking to the input y.

$macro movePlayer x y z { $assert y >= 0 tp @s (~ + $x) (~ + $y) (~ + $z) } -

This next example is more complicated, and could be used when you have a list of effect strings that need to be applied. When the string "clear" is passed in, the effect @s clear syntax is used automatically. Additionally, a message is sent to the player telling them that they've received an effect using a user-friendly display string

+

This next example is more complicated, and could be used when you have a list of effect strings that need to be applied. When the string "clear" is passed in, the effect @s clear syntax is used automatically. Additionally, a message is sent to the player telling them that they've received an effect using a user-friendly display string

$macro giveEffect effectName { $if effectName == "clear" effect @s clear @@ -50,4 +50,4 @@ print "You've received the effect $effectName!" } } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/manual-installation.html b/mccompiled/docs/manual-installation.html index 1733c53..7e0d0e7 100644 --- a/mccompiled/docs/manual-installation.html +++ b/mccompiled/docs/manual-installation.html @@ -1,9 +1,9 @@ -Manual Installation | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Manual Installation

The installer is the easiest way to install, uninstall, and update the software; However, having control over how the software is installed is needed in some circumstances.

Download

Grab your desired release from the Releases Page. MCCompiled has a portable binary, so unzip the release where you would like it to be installed at.

Registering to the System

Add the directory containing mc-compiled.exe to your system-wide PATH variable. Restart any open terminal instances, and then make sure that a command like mc-compiled --version works properly.

Run result of 'mc-compiled --version'

Protocol Launch

When the web editor wants to launch the language server, it uses a URL protocol to do so. To register it with your system, open an administrator-level command line and run the command mc-compiled --protocol. You may need to restart your browser or computer if the server fails to launch.

Uninstall

Uninstalling is as simple as running mc-compiled --protocol_remove (if protocol support was installed in the first place), removing the entry from your PATH variable, and deleting the folder that holds all the files related to the binary. Additionally, remove %localappdata%/.mccompiled to remove any cached files.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Manual Installation

The installer is the easiest way to install, uninstall, and update the software; However, having control over how the software is installed is needed in some circumstances.

Download

Grab your desired release from the Releases Page. MCCompiled has a portable binary, so unzip the release where you would like it to be installed at.

Registering to the System

Add the directory containing mc-compiled.exe to your system-wide PATH variable. Restart any open terminal instances, and then make sure that a command like mc-compiled --version works properly.

Run result of 'mc-compiled --version'

Protocol Launch

When the web editor wants to launch the language server, it uses a URL protocol to do so. To register it with your system, open an administrator-level command line and run the command mc-compiled --protocol. You may need to restart your browser or computer if the server fails to launch.

Uninstall

Uninstalling is as simple as running mc-compiled --protocol_remove (if protocol support was installed in the first place), removing the entry from your PATH variable, and deleting the folder that holds all the files related to the binary. Additionally, remove %localappdata%/.mccompiled to remove any cached files.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/metaprogramming.html b/mccompiled/docs/metaprogramming.html index e317b61..0903be3 100644 --- a/mccompiled/docs/metaprogramming.html +++ b/mccompiled/docs/metaprogramming.html @@ -1,9 +1,9 @@ -Metaprogramming | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Metaprogramming

The preprocessor is an incredibly powerful tool, so this page goes over how to use it in a more advanced way to both generate and use functions and values with fully dynamic names.

Introduction

To introduce this topic, we're going to begin with a set of example data to use across the page. It consists of a list of mob names that we wish to create two utility functions for; count_(mob name) and killAll_(mob name).

+}

MCCompiled Wiki 1.18.1 Help

Metaprogramming

The preprocessor is an incredibly powerful tool, so this page goes over how to use it in a more advanced way to both generate and use functions and values with fully dynamic names.

Introduction

To introduce this topic, we're going to begin with a set of example data to use across the page. It consists of a list of mob names that we wish to create two utility functions for; count_(mob name) and killAll_(mob name).

$var mobs "pig" "cow" "sheep" "chicken" "llama" -

Iterating

The first step to accomplish this example is to iterate over all the items in the mobs preprocessor variable. This can be done using $iterate. For every item in the list of mobs, we want to create a function which will kill all of that specific mob.

This is possible because the function command accepts a string input as a name, not just an identifier. This allows you to use preprocessor variables in the name, thus becoming a foothold into metaprogramming.

+

Iterating

The first step to accomplish this example is to iterate over all the items in the mobs preprocessor variable. This can be done using $iterate. For every item in the list of mobs, we want to create a function which will kill all of that specific mob.

This is possible because the function command accepts a string input as a name, not just an identifier. This allows you to use preprocessor variables in the name, thus becoming a foothold into metaprogramming.

// loop over every mob in the "mobs" preprocessor variable. $iterate mobs mob { // kills all of the given mob. @@ -23,7 +23,7 @@ kill @e[type=$mob] } } -

Without doing anything else, you now have five functions available each with the correct code inside:

Example showing all five newly created functions.

Calling

Next, let's create a function called killAll which runs all the created killAll functions we've created using metaprogramming. You could do it the obvious way:

+

Without doing anything else, you now have five functions available each with the correct code inside:

Example showing all five newly created functions.

Calling

Next, let's create a function called killAll which runs all the created killAll functions we've created using metaprogramming. You could do it the obvious way:

function killAll { killAll_pig() killAll_cow() @@ -31,12 +31,12 @@ killAll_chicken() killAll_llama() } -

Or you could use the $call command, which calls a function based on a string name. The command accepts parameters same as a regular function call does, and it even compiles exactly the same.

+

Or you could use the $call command, which calls a function based on a string name. The command accepts parameters same as a regular function call does, and it even compiles exactly the same.

function killAll { $iterate mobs mob $call "killAll_$mob" } -

As your "mobs" list expands, so will their functions and the killAll function. This lowers the time cost of making changes, as well as guarding against user error. If the code works, it will continue to work as the data changes/expands.

Values

Next, we're going to expand the example to include a count_(mob name) function which stores the mob count in a value created specifically for that mob.

Identical to the function command, the define command also can accept a string as the name input.

+

As your "mobs" list expands, so will their functions and the killAll function. This lowers the time cost of making changes, as well as guarding against user error. If the code works, it will continue to work as the data changes/expands.

Values

Next, we're going to expand the example to include a count_(mob name) function which stores the mob count in a value created specifically for that mob.

Identical to the function command, the define command also can accept a string as the name input.

// loop over every mob in the "mobs" preprocessor variable. $iterate mobs mob { @@ -51,10 +51,10 @@ define global int "amountOf_$mob" = 0 } } -

Using the Values

Using a value defined by a string is a little more challenging than with functions. The getValueByName function is built in to the compiler, see built-in functions for more information about these. The function accepts one string parameter, being the name of the value to get. If the function successfully finds a value with the given name, it will be replaced with that value.

+

Using the Values

Using a value defined by a string is a little more challenging than with functions. The getValueByName function is built in to the compiler, see built-in functions for more information about these. The function accepts one string parameter, being the name of the value to get. If the function successfully finds a value with the given name, it will be replaced with that value.

// add one to this mob's amountOf value that we defined earlier getValueByName("amountOf_$mob") += 1 -

Completed Example

With all of these concepts combined, here is the final file, containing:

  • A killAll_$mob function for every mob in the list.

  • A count_$mob function for every mob in the list.

  • A value amountOf_$mob for every mob in the list.

  • A function killAll which calls all defined "killAll" functions.

  • A function countAll which calls all defined "countAll" functions.

+

Completed Example

With all of these concepts combined, here is the final file, containing:

  • A killAll_$mob function for every mob in the list.

  • A count_$mob function for every mob in the list.

  • A value amountOf_$mob for every mob in the list.

  • A function killAll which calls all defined "killAll" functions.

  • A function countAll which calls all defined "countAll" functions.

$var mobs "pig" "cow" "sheep" "chicken" "llama" $iterate mobs mob { @@ -78,7 +78,7 @@ $iterate mobs mob $call "count_$mob" } -

Expanded Example

Without metaprogramming, the code would look like this; it's simpler, but harder to maintain the larger the data gets, as well as being more tedious when trying to make changes to the logic of the code.

+

Expanded Example

Without metaprogramming, the code would look like this; it's simpler, but harder to maintain the larger the data gets, as well as being more tedious when trying to make changes to the logic of the code.

function export killAll_pig { kill @e[type=pig] } @@ -140,4 +140,4 @@ count_chicken() count_llama() } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/optional-features.html b/mccompiled/docs/optional-features.html index d07c1c5..abad592 100644 --- a/mccompiled/docs/optional-features.html +++ b/mccompiled/docs/optional-features.html @@ -1,9 +1,9 @@ -Optional Features | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Optional Features

MCCompiled contains additional features which are disabled by default due to the way they affect compiled output. Because these features being implicitly enabled would be off-putting and potentially unwanted for developers, we decided to make them opt in only.

Dummies

+}

MCCompiled Wiki 1.18.1 Help

Optional Features

MCCompiled contains additional features which are disabled by default due to the way they affect compiled output. Because these features being implicitly enabled would be off-putting and potentially unwanted for developers, we decided to make them opt in only.

Dummies

feature dummies -

Dummy entities are a feature with an associated command that lets developers spawn, manipulate, and despawn invisible "marker" entities in the world. Dummy entities cannot be seen by players or interacted with.

Spawning Dummies

Spawning a dummy is done using the dummy create command. Its syntax is:

  • dummy create <string: name> [string: tag] <coord: x> <coord: y> <coord: z>

  • dummy single <string: name> [string: tag] <coord: x> <coord: y> <coord: z>

If the tag parameter is specified, the dummy will be created pre-tagged, particularly useful since Minecraft doesn't support summoning entities with tags on them.

When to use Single

The single subcommand ensures that all other dummies with the same name are despawned. You're guaranteed that if you use the single subcommand, there will only ever be, at maximum, one dummy with the given name.

Removing Dummies

The syntax to remove dummy(s) is:

  • dummy remove <string: name> [string: tag]

  • dummy removeall [string: tag]

If the tag parameter is specified in either case, only dummies with the matching tag will be removed.

Using Dummies Elsewhere

By Name

Commands which require selectors also accept strings. If the string matches a known name of a dummy that has been previously spawned, it will automatically be converted to the correct selector for that dummy.

...But Manually

When dummies are enabled, the preprocessor variable dummy is set to the identifier of the entity type, allowing you to use it in other parts of your code:

  • @e[type=$dummy,name=example]

  • @e[type=$dummy,name=example,tag=some_tag]

AutoInit

+

Dummy entities are a feature with an associated command that lets developers spawn, manipulate, and despawn invisible "marker" entities in the world. Dummy entities cannot be seen by players or interacted with.

Spawning Dummies

Spawning a dummy is done using the dummy create command. Its syntax is:

  • dummy create <string: name> [string: tag] <coord: x> <coord: y> <coord: z>

  • dummy single <string: name> [string: tag] <coord: x> <coord: y> <coord: z>

If the tag parameter is specified, the dummy will be created pre-tagged, particularly useful since Minecraft doesn't support summoning entities with tags on them.

When to use Single

The single subcommand ensures that all other dummies with the same name are despawned. You're guaranteed that if you use the single subcommand, there will only ever be, at maximum, one dummy with the given name.

Removing Dummies

The syntax to remove dummy(s) is:

  • dummy remove <string: name> [string: tag]

  • dummy removeall [string: tag]

If the tag parameter is specified in either case, only dummies with the matching tag will be removed.

Using Dummies Elsewhere

By Name

Commands which require selectors also accept strings. If the string matches a known name of a dummy that has been previously spawned, it will automatically be converted to the correct selector for that dummy.

...But Manually

When dummies are enabled, the preprocessor variable dummy is set to the identifier of the entity type, allowing you to use it in other parts of your code:

  • @e[type=$dummy,name=example]

  • @e[type=$dummy,name=example,tag=some_tag]

AutoInit

feature autoinit -

When you make a change to your code, which adds any new scoreboard objectives, you generally need to re-run the init function in-game. This can become tedious over time, as well as being downright unmaintainable for dynamic worlds.

The AutoInit feature keeps track of your current build and re-runs init every time a new build is detected. This feature is especially useful in Marketplace deployments or rapid iteration while code is being developed.

All you have to do is enable the feature, and it gets to work immediately. It's not enabled by default as it:

  1. Tracks build number, which may be unwanted.

  2. Adds a per-tick check which may slightly impact performance.

  3. Adds an extra function to the root of the functions folder, _autoinit.mcfunction.

Exploders

+

When you make a change to your code, which adds any new scoreboard objectives, you generally need to re-run the init function in-game. This can become tedious over time, as well as being downright unmaintainable for dynamic worlds.

The AutoInit feature keeps track of your current build and re-runs init every time a new build is detected. This feature is especially useful in Marketplace deployments or rapid iteration while code is being developed.

All you have to do is enable the feature, and it gets to work immediately. It's not enabled by default as it:

  1. Tracks build number, which may be unwanted.

  2. Adds a per-tick check which may slightly impact performance.

  3. Adds an extra function to the root of the functions folder, _autoinit.mcfunction.

Exploders

feature exploders -

Enables the use of the explode command. Requires the creation of an entity along with event code for all the different presets you might make for it.

This feature is disabled by default because it generates an entity file along with quite a few events/component groups.

Creating Explosions

The syntax of the command is:

  • explode [coord: x] [coord: y] [coord: z] [int: power]

    [int: delay] [bool: causes fire] [bool: breaks blocks]

And an explanation of each non-standard parameter is as follows:

power

The power of the explosion. For reference, a creeper's power is 3, primed TNT is 4, and a charged creeper is 6.

delay

The number of ticks to delay the explosion.

causes fire

If the explosion should spawn fire.

breaks blocks

If the explosion should break blocks.

Uninstall

+

Enables the use of the explode command. Requires the creation of an entity along with event code for all the different presets you might make for it.

This feature is disabled by default because it generates an entity file along with quite a few events/component groups.

Creating Explosions

The syntax of the command is:

  • explode [coord: x] [coord: y] [coord: z] [int: power]

    [int: delay] [bool: causes fire] [bool: breaks blocks]

And an explanation of each non-standard parameter is as follows:

power

The power of the explosion. For reference, a creeper's power is 3, primed TNT is 4, and a charged creeper is 6.

delay

The number of ticks to delay the explosion.

causes fire

If the explosion should spawn fire.

breaks blocks

If the explosion should break blocks.

Uninstall

feature uninstall -

The "uninstall" feature creates a file called uninstall.mcfunction which contains everything needed to eject the addon from the world as closely to perfect as possible. The following is performed when uninstall is run in-game:

Uninstall Procedure

  1. If dummies are enabled, remove all of them from the world.

  2. Removes all temporary/compiler generated scoreboard objectives.

  3. Removes all user-created scoreboard objectives.

  4. Removes all known tags from every loaded entity.

Tests

+

The "uninstall" feature creates a file called uninstall.mcfunction which contains everything needed to eject the addon from the world as closely to perfect as possible. The following is performed when uninstall is run in-game:

Uninstall Procedure

  1. If dummies are enabled, remove all of them from the world.

  2. Removes all temporary/compiler generated scoreboard objectives.

  3. Removes all user-created scoreboard objectives.

  4. Removes all known tags from every loaded entity.

Tests

feature tests -

Enables the use of tests and the generation of all needed files.

See the full page on how to write and use tests.

Audio Files

+

Enables the use of tests and the generation of all needed files.

See the full page on how to write and use tests.

Audio Files

feature audiofiles -

Enables the playsound command to accept audio files directly and generate the sound_definitions.json file automatically. Will copy the audio files into the resource pack every compilation.

See the full page on how to use audio files in MCCompiled.

Last modified: 24 April 2024
\ No newline at end of file +

Enables the playsound command to accept audio files directly and generate the sound_definitions.json file automatically. Will copy the audio files into the resource pack every compilation.

See the full page on how to use audio files in MCCompiled.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/playsound.html b/mccompiled/docs/playsound.html index 68c613e..363c5e5 100644 --- a/mccompiled/docs/playsound.html +++ b/mccompiled/docs/playsound.html @@ -1,9 +1,9 @@ -Playsound | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Playsound

MCCompiled supports the native syntax of the playsound command, but also has a convenience method for easily importing audio files and setting them up for use in your projects.

Enabling the Feature

You must have the audiofiles feature enabled. See here on how to enable features. This functionality is not enabled by default because it creates entries in the sound_definitions.json file and copies audio files every compilation.

Using Audio Files

Once the feature is enabled, the playsound command will accept an audio file input of either .wav, .ogg, or .fsb.

+}

MCCompiled Wiki 1.18.1 Help

Playsound

MCCompiled supports the native syntax of the playsound command, but also has a convenience method for easily importing audio files and setting them up for use in your projects.

Enabling the Feature

You must have the audiofiles feature enabled. See here on how to enable features. This functionality is not enabled by default because it creates entries in the sound_definitions.json file and copies audio files every compilation.

Using Audio Files

Once the feature is enabled, the playsound command will accept an audio file input of either .wav, .ogg, or .fsb.

feature audiofiles playsound "resources/explosion.wav" @a ~ ~ ~ -

Sub-folders

In the example above, the explosion.ogg audio file is located in the subfolder resources. As such, the file will be copied into the subfolder sounds/resources in the output. This rule applies to any file which is relative to the location of the project file.

Last modified: 24 April 2024
\ No newline at end of file +

Sub-folders

In the example above, the explosion.ogg audio file is located in the subfolder resources. As such, the file will be copied into the subfolder sounds/resources in the output. This rule applies to any file which is relative to the location of the project file.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/preprocessor.html b/mccompiled/docs/preprocessor.html index 2666eca..77cb301 100644 --- a/mccompiled/docs/preprocessor.html +++ b/mccompiled/docs/preprocessor.html @@ -1,9 +1,9 @@ -Preprocessor | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Preprocessor

The preprocessor is a powerful collection of features aimed at doing as much work during compile time as possible. It contains features for code generation, data driving via. JSON files, macros, testing, and so much more. The preprocessor offers a guarantee that any code using it will always run at compile time, and that you will only get compile-time errors.

Introduction to Dereferencing

Generally, anything marked with a dollar sign $ is part of preprocessor code. It is going to affect the compiled result in some way, but it does not directly contribute to its contents. The simplest example of how the preprocessor could be used is the following example:

+}

MCCompiled Wiki 1.18.1 Help

Preprocessor

The preprocessor is a powerful collection of features aimed at doing as much work during compile time as possible. It contains features for code generation, data driving via. JSON files, macros, testing, and so much more. The preprocessor offers a guarantee that any code using it will always run at compile time, and that you will only get compile-time errors.

Introduction to Dereferencing

Generally, anything marked with a dollar sign $ is part of preprocessor code. It is going to affect the compiled result in some way, but it does not directly contribute to its contents. The simplest example of how the preprocessor could be used is the following example:

$var text "This is some reusable text!" print "Need some text? $text" -

In this example, a preprocessor variable is defined using $var-- it's given the name "text" and the value "This is some reusable text!" Then, the variable is dereferenced (inserted) into a print command's contents. There are no runtime changes happening here, the preprocessor variable is baked into the string at compile time. It works like a constant here.

Notice how dereferencing a preprocessor variable uses the dollar sign $. Preprocessor variables are not just limited to strings, but many types of items. Anywhere it is dereferenced, its contents will be placed as if they were in the original code. Dereferencing is always the first step taken by MCCompiled when analyzing a statement.

Example Using Arrays

+

In this example, a preprocessor variable is defined using $var-- it's given the name "text" and the value "This is some reusable text!" Then, the variable is dereferenced (inserted) into a print command's contents. There are no runtime changes happening here, the preprocessor variable is baked into the string at compile time. It works like a constant here.

Notice how dereferencing a preprocessor variable uses the dollar sign $. Preprocessor variables are not just limited to strings, but many types of items. Anywhere it is dereferenced, its contents will be placed as if they were in the original code. Dereferencing is always the first step taken by MCCompiled when analyzing a statement.

Example Using Arrays

$var spawnLocation 651 -5291 102 tp @a $spawnLocation -

This example is much more interesting. We store three coordinates in the preprocessor variable "spawnLocation." We were then able to dereference it to fulfill all three arguments of the tp command at once. You can think of this dereferencing as a copying of the contents from "spawnLocation" directly into the source code.

You can likely see how this concept can be utilized to quickly and easily create code at compile time, as well as drive code using data.

Dereferencing using Indexer

You can also use an indexer to dereference a specific part of the preprocessor variable. When using an indexer, the variable is implicitly dereferenced. The reason for this is that there is a semantic difference between $a[0] and a[0].

As defined in the order-of-operations, MCCompiled always evaluates a dereference operation $ before it evaluates an indexing operation. Consider the following example:

+

This example is much more interesting. We store three coordinates in the preprocessor variable "spawnLocation." We were then able to dereference it to fulfill all three arguments of the tp command at once. You can think of this dereferencing as a copying of the contents from "spawnLocation" directly into the source code.

You can likely see how this concept can be utilized to quickly and easily create code at compile time, as well as drive code using data.

Dereferencing using Indexer

You can also use an indexer to dereference a specific part of the preprocessor variable. When using an indexer, the variable is implicitly dereferenced. The reason for this is that there is a semantic difference between $a[0] and a[0].

As defined in the order-of-operations, MCCompiled always evaluates a dereference operation $ before it evaluates an indexing operation. Consider the following example:

$var text "Example" -

We've defined a variable called "text" which contains one string, being "Example." If you dereference the preprocessor variable before indexing, you're just indexing the string because dereferences come before indexing:

Steps (dereferencing)

  1. $text[0]

  2. "Example"[0]

  3. "E"

Without the dereference, you're indexing the preprocessor variable directly, which fetches an element from it and dereferences just that element.

Steps (not dereferencing)

  1. text[0]

  2. "Example"

Last modified: 24 April 2024
\ No newline at end of file +

We've defined a variable called "text" which contains one string, being "Example." If you dereference the preprocessor variable before indexing, you're just indexing the string because dereferences come before indexing:

Steps (dereferencing)

  1. $text[0]

  2. "Example"[0]

  3. "E"

Without the dereference, you're indexing the preprocessor variable directly, which fetches an element from it and dereferences just that element.

Steps (not dereferencing)

  1. text[0]

  2. "Example"

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/regolith-installation.html b/mccompiled/docs/regolith-installation.html index b6efdad..4d95803 100644 --- a/mccompiled/docs/regolith-installation.html +++ b/mccompiled/docs/regolith-installation.html @@ -1,9 +1,9 @@ -Regolith Installation | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Regolith Installation

Embedding MCCompiled into a Regolith project is super simple. Support is maintained by the developers, and updates for the filter are released at the same time as binary versions.

How to Install

+}

MCCompiled Wiki 1.18.1 Help

Regolith Installation

Embedding MCCompiled into a Regolith project is super simple. Support is maintained by the developers, and updates for the filter are released at the same time as binary versions.

How to Install

regolith install github.com/7UKECREAT0R/MCCompiledRegolith/mc-compiled -

To install the latest version of MCCompiled to the Regolith project in the current directory.

Last modified: 24 April 2024
\ No newline at end of file +

To install the latest version of MCCompiled to the Regolith project in the current directory.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/runtime.html b/mccompiled/docs/runtime.html index 1046db8..ffa22e0 100644 --- a/mccompiled/docs/runtime.html +++ b/mccompiled/docs/runtime.html @@ -1,9 +1,9 @@ -Runtime | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Runtime

Code that runs during runtime is the backbone of all projects. Without runtime commands, there would be nothing happening in-game. You can think of everything under the 'runtime' category as things that happen in the game and can't be determined before being run.

Runtime is a massive category, so it may be useful to choose a topic you're interested in learning about before attempting to tackle the entire runtime documentation:

Niche Stuff

There are also articles on the more complex commands in MCCompiled, as well as rich features which are built for the creation of addons.

Ultimately, whatever you decide to touch first is up to you. MCCompiled is massive but worth learning about every little feature available.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Runtime

Code that runs during runtime is the backbone of all projects. Without runtime commands, there would be nothing happening in-game. You can think of everything under the 'runtime' category as things that happen in the game and can't be determined before being run.

Runtime is a massive category, so it may be useful to choose a topic you're interested in learning about before attempting to tackle the entire runtime documentation:

Niche Stuff

There are also articles on the more complex commands in MCCompiled, as well as rich features which are built for the creation of addons.

Ultimately, whatever you decide to touch first is up to you. MCCompiled is massive but worth learning about every little feature available.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/scatter.html b/mccompiled/docs/scatter.html index e4a129d..194945f 100644 --- a/mccompiled/docs/scatter.html +++ b/mccompiled/docs/scatter.html @@ -1,9 +1,9 @@ -Scatter | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Scatter

The fill command fills an area with blocks, but there's no control of any randomness. The scatter command does this.

  • scatter <block> <percentage> <x1, y1, z1> <x2, y2, z2>

Technicalities

The scatter command generates a structure which is then loaded into the world with the integrity parameter. This poses a few issues that are not a part of the vanilla fill command.

Dynamic Sizing

As the structure is generated at compile-time, it does not support having a dynamic fill region size. The size must be known at compile-time, either by having all coordinates relative, or by having all coordinates static.

Block Data

It's much harder for the compiler to embed data into the structure file, as it doesn't have the same information that Minecraft has internally. We're looking to revisit this in the future, but for now, there is no support for block data.

Last modified: 24 April 2024
\ No newline at end of file +}

MCCompiled Wiki 1.18.1 Help

Scatter

The fill command fills an area with blocks, but there's no control of any randomness. The scatter command does this.

  • scatter <block> <percentage> <x1, y1, z1> <x2, y2, z2>

Technicalities

The scatter command generates a structure which is then loaded into the world with the integrity parameter. This poses a few issues that are not a part of the vanilla fill command.

Dynamic Sizing

As the structure is generated at compile-time, it does not support having a dynamic fill region size. The size must be known at compile-time, either by having all coordinates relative, or by having all coordinates static.

Block Data

It's much harder for the compiler to embed data into the structure file, as it doesn't have the same information that Minecraft has internally. We're looking to revisit this in the future, but for now, there is no support for block data.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/simple-variable-commands.html b/mccompiled/docs/simple-variable-commands.html index 2bccdd9..c296289 100644 --- a/mccompiled/docs/simple-variable-commands.html +++ b/mccompiled/docs/simple-variable-commands.html @@ -1,9 +1,9 @@ -Simple Variable Commands | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Simple Variable Commands

Variables are the main way of dealing with data during the preprocessing phase. If you want to store, keep track of, or modify data in some way, you'll need to use variables. The easiest way to create a variable is using the syntax:

+}

MCCompiled Wiki 1.18.1 Help

Simple Variable Commands

Variables are the main way of dealing with data during the preprocessing phase. If you want to store, keep track of, or modify data in some way, you'll need to use variables. The easiest way to create a variable is using the syntax:

$var [name] [values...] -

This will create a variable with a name and value. Preprocessor variables can hold as many values as you would like, sort of like how lists work in other languages; however, their behavior remains consistent whether they have one value or multiple. This is expanded upon later.

Incrementation (and how to specify 'id')

You can increment and decrement variables using $inc and $dec respectively. These commands will increment all values in the given preprocessor variable at once.

These commands accept one parameter, being of the type id. It is not looking for a value, but rather the identifier of a preprocessor variable. Consider the following example, which would not be valid:

+

This will create a variable with a name and value. Preprocessor variables can hold as many values as you would like, sort of like how lists work in other languages; however, their behavior remains consistent whether they have one value or multiple. This is expanded upon later.

Incrementation (and how to specify 'id')

You can increment and decrement variables using $inc and $dec respectively. These commands will increment all values in the given preprocessor variable at once.

These commands accept one parameter, being of the type id. It is not looking for a value, but rather the identifier of a preprocessor variable. Consider the following example, which would not be valid:

// this example is intentionally incorrect $var example 15 $inc $example -

By dereferencing the variable "example," we place its contents into the command, making it effectively $inc 15. Of course, this doesn't make any sense. You can't do anything by incrementing a literal number, you want to increment the variable itself.

The proper way to do this is simply to specify the identifier of the preprocessor variable, or in this case, example. The command knows it will be given an identifier (evidenced by its parameter, <id: variable>), and thus it knows what to do with this identifier.

Simple Math Operations

MCCompiled has all the necessary commands for doing math with preprocessor variables. Don't let this be a red flag, as there are still inline operations you can perform. The main advantage of using these commands is that

  1. It's clear that a change is happening to the input variables.

  2. These commands loop the operands to match the number of inputs.

Looping Operands

When one of these operations is run without enough operands to match the number of entries in the preprocessor variable, the operands are looped. If you had a preprocessor variable containing 2 3 4 5 6, and ran $add variable 10 1, you would get the result 12 4 14 6 16. This is because the operands you specify are looped to match the input length (5).

All of Them

Here's a list of all the math operations in MCCompiled which follow the rules described in this section.

Add to Preprocessor Variable

Performs addition. A += B for each item in the variable.

Subtract from Preprocessor Variable

Performs subtraction. A -= B for each item in the variable.

Multiply with Preprocessor Variable

Performs multiplication. A *= B for each item in the variable.

Divide Preprocessor Variable

Performs division. A /= B for each item in the variable.

Modulo Preprocessor Variable

Performs modulus. A %= B for each item in the variable.

Exponentiate Preprocessor Variable

Performs exponentiation (power). A to the power of B for each item in the variable.

Other Variable Operations

There are some other less widely used operations that deserve their own list... just away from everything else.

Swap

Swap will swap the contents of two given preprocessor variables, regardless of length. In the following example, the variable two ends up containing "hello" "world" and vice versa.

+

By dereferencing the variable "example," we place its contents into the command, making it effectively $inc 15. Of course, this doesn't make any sense. You can't do anything by incrementing a literal number, you want to increment the variable itself.

The proper way to do this is simply to specify the identifier of the preprocessor variable, or in this case, example. The command knows it will be given an identifier (evidenced by its parameter, <id: variable>), and thus it knows what to do with this identifier.

Simple Math Operations

MCCompiled has all the necessary commands for doing math with preprocessor variables. Don't let this be a red flag, as there are still inline operations you can perform. The main advantage of using these commands is that

  1. It's clear that a change is happening to the input variables.

  2. These commands loop the operands to match the number of inputs.

Looping Operands

When one of these operations is run without enough operands to match the number of entries in the preprocessor variable, the operands are looped. If you had a preprocessor variable containing 2 3 4 5 6, and ran $add variable 10 1, you would get the result 12 4 14 6 16. This is because the operands you specify are looped to match the input length (5).

All of Them

Here's a list of all the math operations in MCCompiled which follow the rules described in this section.

Add to Preprocessor Variable

Performs addition. A += B for each item in the variable.

Subtract from Preprocessor Variable

Performs subtraction. A -= B for each item in the variable.

Multiply with Preprocessor Variable

Performs multiplication. A *= B for each item in the variable.

Divide Preprocessor Variable

Performs division. A /= B for each item in the variable.

Modulo Preprocessor Variable

Performs modulus. A %= B for each item in the variable.

Exponentiate Preprocessor Variable

Performs exponentiation (power). A to the power of B for each item in the variable.

Other Variable Operations

There are some other less widely used operations that deserve their own list... just away from everything else.

Swap

Swap will swap the contents of two given preprocessor variables, regardless of length. In the following example, the variable two ends up containing "hello" "world" and vice versa.

$var one "hello" "world" $var two 9 8 7 6 5 4 3 2 1 $swap one two -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/syntax.html b/mccompiled/docs/syntax.html index e3717c0..a167222 100644 --- a/mccompiled/docs/syntax.html +++ b/mccompiled/docs/syntax.html @@ -1,9 +1,9 @@ -Syntax | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Syntax

MCCompiled's syntax is similar to regular Minecraft commands, with a little bit of c-style sprinkled in for extra features. This page goes over some miscellaneous syntax that will be used/referred to throughout the documentation.

Comments

A comment is a note to leave to yourself in the source code. You might add one to explain why you wrote code a certain way, or maybe to explain a complicated section of code. It's also useful to leave comments so that other developers can more easily understand what your code is doing.

There are two different kinds of comments; single-line and multi-line. They use slightly different syntax for each.

+}

MCCompiled Wiki 1.18.1 Help

Syntax

MCCompiled's syntax is similar to regular Minecraft commands, with a little bit of c-style sprinkled in for extra features. This page goes over some miscellaneous syntax that will be used/referred to throughout the documentation.

Comments

A comment is a note to leave to yourself in the source code. You might add one to explain why you wrote code a certain way, or maybe to explain a complicated section of code. It's also useful to leave comments so that other developers can more easily understand what your code is doing.

There are two different kinds of comments; single-line and multi-line. They use slightly different syntax for each.

// This is a comment that only spans a single line. /* @@ -21,30 +21,30 @@ You can add whatever you want anywhere between the opening and closing markers. */ -

Documentation

Some items can be documented, such as macros, functions, or values. Documenting can be done by leaving a comment before defining the item, done using $macro, define, and function respectively. Documented items will show up under the item's keyword in any editors/IDEs that support MCCompiled.

The example below shows documenting a function:

+

Documentation

Some items can be documented, such as macros, functions, or values. Documenting can be done by leaving a comment before defining the item, done using $macro, define, and function respectively. Documented items will show up under the item's keyword in any editors/IDEs that support MCCompiled.

The example below shows documenting a function:

// Resets all game-related values. function reset { score[*] = 0 inGame[*] = false timeLeft[*] = 0 } -
Example of what the documentation looks in the editor.

Common Tokens

A "token" is just a unit of some value, whether it be an integer, decimal number, boolean, or even text. All of these qualify as a token. Text is commonly referred to as a string, being that it's a string of characters. The following sections will touch on exactly how to specify these different tokens.

Strings

A string is just another word for a piece of text. They can be specified using either ' or ", depending on preference. The string must be opened and closed using the same character. An example string looks like: "Hello World!".

Inlaying Preprocessor Variables

The value(s) of a preprocessor variable can be placed into a string using the dereference operator. $ If you wanted to place the variable example into a string, it would look like the following: 'The example is $example'.

Escaping

When you have something in your string that you don't wish to be counted as code, you can escape \ it using a backslash. This also works for the opening/closing character itself. This is particularly useful if you wish to use a quotation mark in your string without closing it. "Mark's \"things\" are pretty old." or try the following example 'Collected \$money!' which won't inlay the preprocessor variable $money.

Integers

An integer is written as a whole number, with or without a negative sign -.

Decimals

When you need to represent a number that is part of a whole, the decimal point . denotes the start of the partial part of the number; e.g., 4.65 or 12.1

Coordinates

Works exactly the same as coordinates in Minecraft commands. Coordinates can be prefixed as positional relative ~ or directional relative ^, and they can be positive or negative; same as integers, e.g., 42, -101, ~30, or ^-5

Ranges

Works exactly the same as ranges in Minecraft commands. Ranges describe a set of numbers, consisting of a left/right side separated by the range operator ... When both sides are specified, the range includes all integers between the two numbers inclusively (meaning that 5..10 will include 5, 6, 7, 8, 9, and 10).

When a side is omitted, the range continues on forever in that direction. ..7 includes 7 and every integer below 7. Likewise, 10.. includes 10 and every number after 10.

Ranges can additionally be inverted using the "not" operator !. This causes the range to include every number except the ones described in the range. !0..50 includes every number except those between 0 and 50 inclusive.

Selectors

Works exactly the same as selectors in Minecraft commands. A selector selects a specific set of entities using special filters.

Learn about target selectors here

Time Suffixes

Numbers support suffixing to better represent time. A simple example of this is 4s, which when be represented as ticks, evaluates to 80. Time suffixes offer the advantage of being context-aware. If a command requires an input in seconds, the seconds suffix s will not apply any change to its attached number. Likewise, if a command requires a tick input, the input will be multiplied according to its need.

The list of available time suffixes is here:

  • t ticks, multiply the number by 1 by default.

  • s seconds, multiply the number by 20 by default.

  • m minutes, multiply the number by 1200 by default.

  • h hours, multiply the number by 72000 by default.

Statements

A statement is just a line of code that does something. A statement could be a command, an operation to a variable, or a call to a function.

Code Blocks

MCCompiled introduces a new concept to commands called "blocks." Blocks are just chunks of statements surrounded with curly braces {}. The opening curly brace can be included on its own line, or at the end of a statement; it's down to preference.

Blocks are usually preceded by a statement which tells you how the code in the block is different from other code. The code might be part of a different function; maybe it only runs under a certain condition; or maybe it runs multiple times instead of just once. The preceding statement is always the one that tells you that.

+
Example of what the documentation looks in the editor.

Common Tokens

A "token" is just a unit of some value, whether it be an integer, decimal number, boolean, or even text. All of these qualify as a token. Text is commonly referred to as a string, being that it's a string of characters. The following sections will touch on exactly how to specify these different tokens.

Strings

A string is just another word for a piece of text. They can be specified using either ' or ", depending on preference. The string must be opened and closed using the same character. An example string looks like: "Hello World!".

Inlaying Preprocessor Variables

The value(s) of a preprocessor variable can be placed into a string using the dereference operator. $ If you wanted to place the variable example into a string, it would look like the following: 'The example is $example'.

Escaping

When you have something in your string that you don't wish to be counted as code, you can escape \ it using a backslash. This also works for the opening/closing character itself. This is particularly useful if you wish to use a quotation mark in your string without closing it. "Mark's \"things\" are pretty old." or try the following example 'Collected \$money!' which won't inlay the preprocessor variable $money.

Integers

An integer is written as a whole number, with or without a negative sign -.

Decimals

When you need to represent a number that is part of a whole, the decimal point . denotes the start of the partial part of the number; e.g., 4.65 or 12.1

Coordinates

Works exactly the same as coordinates in Minecraft commands. Coordinates can be prefixed as positional relative ~ or directional relative ^, and they can be positive or negative; same as integers, e.g., 42, -101, ~30, or ^-5

Ranges

Works exactly the same as ranges in Minecraft commands. Ranges describe a set of numbers, consisting of a left/right side separated by the range operator ... When both sides are specified, the range includes all integers between the two numbers inclusively (meaning that 5..10 will include 5, 6, 7, 8, 9, and 10).

When a side is omitted, the range continues on forever in that direction. ..7 includes 7 and every integer below 7. Likewise, 10.. includes 10 and every number after 10.

Ranges can additionally be inverted using the "not" operator !. This causes the range to include every number except the ones described in the range. !0..50 includes every number except those between 0 and 50 inclusive.

Selectors

Works exactly the same as selectors in Minecraft commands. A selector selects a specific set of entities using special filters.

Learn about target selectors here

Time Suffixes

Numbers support suffixing to better represent time. A simple example of this is 4s, which when be represented as ticks, evaluates to 80. Time suffixes offer the advantage of being context-aware. If a command requires an input in seconds, the seconds suffix s will not apply any change to its attached number. Likewise, if a command requires a tick input, the input will be multiplied according to its need.

The list of available time suffixes is here:

  • t ticks, multiply the number by 1 by default.

  • s seconds, multiply the number by 20 by default.

  • m minutes, multiply the number by 1200 by default.

  • h hours, multiply the number by 72000 by default.

Statements

A statement is just a line of code that does something. A statement could be a command, an operation to a variable, or a call to a function.

Code Blocks

MCCompiled introduces a new concept to commands called "blocks." Blocks are just chunks of statements surrounded with curly braces {}. The opening curly brace can be included on its own line, or at the end of a statement; it's down to preference.

Blocks are usually preceded by a statement which tells you how the code in the block is different from other code. The code might be part of a different function; maybe it only runs under a certain condition; or maybe it runs multiple times instead of just once. The preceding statement is always the one that tells you that.

if timeLeft <= 0 { globalprint "Time is up!" tp @a 40 100 50 } -

In the example above, there are two statements contained within the block:

+

In the example above, there are two statements contained within the block:

‎ ‎ globalprint "Time is up!" tp @a 40 100 50 ‎ -

This block only runs under the condition placed right before it, if timeLeft <= 0. The statement that preceded the block modified how the block runs. This concept is used all throughout the language, and you'll find that there are many kinds of commands which modify the way blocks run.

Omitting Brackets

Commands which require blocks can also accept a single statement if you wish. This is just a syntax sugar thing, it doesn't impact the way the code runs. It's just important to remember that when using this syntax, only the first statement will fall under the rules of the command in question. The two following examples are identical:

+

This block only runs under the condition placed right before it, if timeLeft <= 0. The statement that preceded the block modified how the block runs. This concept is used all throughout the language, and you'll find that there are many kinds of commands which modify the way blocks run.

Omitting Brackets

Commands which require blocks can also accept a single statement if you wish. This is just a syntax sugar thing, it doesn't impact the way the code runs. It's just important to remember that when using this syntax, only the first statement will fall under the rules of the command in question. The two following examples are identical:

if deadPlayerCount == allPlayerCount { endGame() }
if deadPlayerCount == allPlayerCount endGame() -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/testing.html b/mccompiled/docs/testing.html index 3aed05c..29f0b47 100644 --- a/mccompiled/docs/testing.html +++ b/mccompiled/docs/testing.html @@ -1,9 +1,9 @@ -Testing | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Testing

When designing larger projects, it becomes increasingly more important to ensure every little piece is not thrown off balance. This is where testing comes in.

This page focuses more on runtime testing. If you're interested in catching errors at compile-time, see here

Enabling Tests

Because tests create extra files in your output, they are guarded behind the tests feature. To enable, specify that you wish to use tests at the top of your file:

+}

MCCompiled Wiki 1.18.1 Help

Testing

When designing larger projects, it becomes increasingly more important to ensure every little piece is not thrown off balance. This is where testing comes in.

This page focuses more on runtime testing. If you're interested in catching errors at compile-time, see here

Enabling Tests

Because tests create extra files in your output, they are guarded behind the tests feature. To enable, specify that you wish to use tests at the top of your file:

feature tests -

Writing a Test

Tests are defined like functions without parameters, except using the keyword test. Inside a test, you can include code that will be run as the player running the test (not global context).

A test requires at least one assertion using the assert command to determine if it passed or failed. Writing assertions is the same as writing a runtime comparison; in fact, it uses the same underlying code.

The following example shows writing a test to make sure that the abs() function (defined at the top) is working as intended.

+

Writing a Test

Tests are defined like functions without parameters, except using the keyword test. Inside a test, you can include code that will be run as the player running the test (not global context).

A test requires at least one assertion using the assert command to determine if it passed or failed. Writing assertions is the same as writing a runtime comparison; in fact, it uses the same underlying code.

The following example shows writing a test to make sure that the abs() function (defined at the top) is working as intended.

function abs(int n) { if n < 0 return n * -1 @@ -29,4 +29,4 @@ assert abs(-3) == 3 assert abs(-8329) == 8329 } -

Each assertion is testing a different case. In projects that include pure functions or important state machines, testing saves time by automating as much of the validation process as possible. It creates a list of guarantees that don't have to be manually validated by quality-assurance.

Running Tests

You can't run tests like functions; they are automatically packed into a function called test in the root of your behavior pack's functions. When a player runs test, every test defined in your project is automatically run from top to bottom.

If a test fails, execution stops and debug information is displayed to alert you as to which test failed, which assertion in that test, and what the values were at the time of assertion.

animation_tests_failed.gif

If all assertions in the test pass, it is displayed to the user as "passed."

animation_tests_succeeded.gif
Last modified: 24 April 2024
\ No newline at end of file +

Each assertion is testing a different case. In projects that include pure functions or important state machines, testing saves time by automating as much of the validation process as possible. It creates a list of guarantees that don't have to be manually validated by quality-assurance.

Running Tests

You can't run tests like functions; they are automatically packed into a function called test in the root of your behavior pack's functions. When a player runs test, every test defined in your project is automatically run from top to bottom.

If a test fails, execution stops and debug information is displayed to alert you as to which test failed, which assertion in that test, and what the values were at the time of assertion.

animation_tests_failed.gif

If all assertions in the test pass, it is displayed to the user as "passed."

animation_tests_succeeded.gif
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/text-commands.html b/mccompiled/docs/text-commands.html index 28b6c56..712d3be 100644 --- a/mccompiled/docs/text-commands.html +++ b/mccompiled/docs/text-commands.html @@ -1,9 +1,9 @@ -Text Commands | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Text Commands

MCCompiled's support for format strings entirely abstracts away the use of JSON raw-text. There are a couple of reasons why JSON was phased out, but most importantly:

  • Writing raw-text is hard and unnecessarily verbose.

  • More opportunities for MCCompiled to take the wheel, especially with types.

  • Better language support without having to extend rawtext's already convoluted syntax.

The commands in MCCompiled mirror the commands in regular Minecraft. With any command in Minecraft that accepts raw-text, its MCCompiled version accepts a format-string.

Syntax

Format strings use the same syntax as regular strings, but their contents are what dictate what should be shown. To insert an item inside a format-string, use curly braces {} surrounding the content to insert. You can insert values, expressions, or selectors.

Inserting Values

To insert a value, place it inside curly braces anywhere in the string you want it to show.

print "You finished with {score} score!" -

Inserting Expressions

If you want to evaluate an expression inside the curly braces, you can do that. The result will be stored in an automagically generated temporary value and displayed as expected!

+

Inserting Expressions

If you want to evaluate an expression inside the curly braces, you can do that. The result will be stored in an automagically generated temporary value and displayed as expected!

actionbar "Time left: {endTime - getCurrentTime()}" -

Inserting Selectors

When inserting a selector, the name(s) of the entity it selects will be displayed. If multiple entities match the selector, their names will be separated by commas. The order which the entities are displayed is not defined.

+

Inserting Selectors

When inserting a selector, the name(s) of the entity it selects will be displayed. If multiple entities match the selector, their names will be separated by commas. The order which the entities are displayed is not defined.

print "{cowCount} remain: {@e[type=cow,tag=game]}" -

Escaping

If you don't want an item in curly braces to be evaluated, use a backslash \ to escape it, making it not be evaluated. Using two backslashes will escape the backslash, making it show as one backslash and not affect the proceeding insert.

+

Escaping

If you don't want an item in curly braces to be evaluated, use a backslash \ to escape it, making it not be evaluated. Using two backslashes will escape the backslash, making it show as one backslash and not affect the proceeding insert.

print "This \{text} shows ingame as-is, without the backslash." print "This \\{text} shows as the value of 'text' with a backslash before it." -

Commands

The commands which support format-strings are listed in the cheat cheet here. If marked with the text " Supports format-strings ", then the command will properly process format-string inputs.

Last modified: 24 April 2024
\ No newline at end of file +

Commands

The commands which support format-strings are listed in the cheat cheet here. If marked with the text " Supports format-strings ", then the command will properly process format-string inputs.

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/types.html b/mccompiled/docs/types.html index 9277b64..ba32d26 100644 --- a/mccompiled/docs/types.html +++ b/mccompiled/docs/types.html @@ -1,9 +1,9 @@ -Types | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Types

Values can have their own types, a way of changing how they interact, add, display to users, convert, etc... You can think of types as presets that change everything about the value in a way that is unified and makes sense.

The greatest thing about types in MCCompiled is that they are very back-seat. They work as you would expect and don't require you to think about conversion anywhere. If it makes sense, then everything just works.

Defining Value with a Type

When defining a value, you optionally can specify type when using define [type] [name]. The most common type is the int

Built-In Types

The int is identical to a Minecraft scoreboard objective.

Limits

Integers are limited to -2^31 to 2^31 - 1. If you overflow an integer by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

Display

When displayed to a player, integers are shown as-is with no formatting applied.

Language Features

Integers support all default language features.

Example

+}

MCCompiled Wiki 1.18.1 Help

Types

Values can have their own types, a way of changing how they interact, add, display to users, convert, etc... You can think of types as presets that change everything about the value in a way that is unified and makes sense.

The greatest thing about types in MCCompiled is that they are very back-seat. They work as you would expect and don't require you to think about conversion anywhere. If it makes sense, then everything just works.

Defining Value with a Type

When defining a value, you optionally can specify type when using define [type] [name]. The most common type is the int

Built-In Types

The int is identical to a Minecraft scoreboard objective.

Limits

Integers are limited to -2^31 to 2^31 - 1. If you overflow an integer by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

Display

When displayed to a player, integers are shown as-is with no formatting applied.

Language Features

Integers support all default language features.

Example

define int exampleValue exampleValue = 42 exampleValue += 10 print "The value is: {exampleValue}" // The value is: 52 -

The decimal can be a decimal number. They're represented as a single scoreboard objective as a fixed point number. As such, decimal numbers need to have their precision specified at the time of definition: decimal [precision]

Limits

Decimals are limited based on their precision. -2^31 * (0.1^precision) to 2^31 - 1 * (0.1^precision) if you overflow an integer by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

To prevent from overflowing prematurely, use precisions as low as you're comfortable with and avoid multiplication or division with numbers that are of precision 3 or higher (as a general rule; not applicable everywhere).

Display

When displayed to a player, decimal numbers are displayed as expected, using a . to denote the decimal part. Zeros will pad the left side of the decimal part, if needed.

Language Features

Decimals support all default language features. When an operation is performed between two decimal numbers and their precisions don't match, the right-hand value is always scaled to match the precision of the land-hand value automatically.

Additionally, if you define a value without a type, opting to specify a decimal number instead, the precision of the defined value will accurately reflect the input. 3.14 would be given a precision of two, 1.5 would be given a precision of one, etc...

Example

+

The decimal can be a decimal number. They're represented as a single scoreboard objective as a fixed point number. As such, decimal numbers need to have their precision specified at the time of definition: decimal [precision]

Limits

Decimals are limited based on their precision. -2^31 * (0.1^precision) to 2^31 - 1 * (0.1^precision) if you overflow an integer by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

To prevent from overflowing prematurely, use precisions as low as you're comfortable with and avoid multiplication or division with numbers that are of precision 3 or higher (as a general rule; not applicable everywhere).

Display

When displayed to a player, decimal numbers are displayed as expected, using a . to denote the decimal part. Zeros will pad the left side of the decimal part, if needed.

Language Features

Decimals support all default language features. When an operation is performed between two decimal numbers and their precisions don't match, the right-hand value is always scaled to match the precision of the land-hand value automatically.

Additionally, if you define a value without a type, opting to specify a decimal number instead, the precision of the defined value will accurately reflect the input. 3.14 would be given a precision of two, 1.5 would be given a precision of one, etc...

Example

define decimal 3 exampleValue exampleValue = 42.521 exampleValue += 10.1 print "The value is: {exampleValue}" // The value is: 52.621 -

The boolean can be either true or false. They're represented as a single scoreboard objective that is either one (true) or zero (false).

Limits

Booleans are limited to only two values by design, as they represent a limited state. They can be set to the literal true or false, nothing else.

Display

When displayed to a player, booleans are represented as pieces of text; by default, this is "true" or "false." This can be changed by setting the preprocessor variables _true and _false respectively to the string you wish to be displayed. When localization is enabled, entries are automatically created as with any other strings.

Language Features

Booleans do not support arithmetic, only assignment, comparison, and display. The if command supports placing only the boolean variable on its own without needing any comparison operators. When this is the case, the boolean value will be checked to see if it's true.

Example

+

The boolean can be either true or false. They're represented as a single scoreboard objective that is either one (true) or zero (false).

Limits

Booleans are limited to only two values by design, as they represent a limited state. They can be set to the literal true or false, nothing else.

Display

When displayed to a player, booleans are represented as pieces of text; by default, this is "true" or "false." This can be changed by setting the preprocessor variables _true and _false respectively to the string you wish to be displayed. When localization is enabled, entries are automatically created as with any other strings.

Language Features

Booleans do not support arithmetic, only assignment, comparison, and display. The if command supports placing only the boolean variable on its own without needing any comparison operators. When this is the case, the boolean value will be checked to see if it's true.

Example

define boolean isGameRunning isGameRunning = true ‎ @@ -35,7 +35,7 @@ ‎ print "Game Status: {isGameRunning}" // Game Status: Running -

The time acts the same as a regular integer, but with extra features for display.

Limits

Time values have the same limits as integers; limited to -2^31 to 2^31 - 1. If you overflow a time by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

Display

When displayed to a player, times are formatted based on the _timeformat preprocessor variable. This variable is a string using lettering and colons to describe how the time should be divided, and where zeros should be inserted.

Time Format

The default time format is m:ss. This implies that the number of minutes should be displayed (m), and the number of seconds should be displayed after it (s). The two s's indicate that they should be padded to always have a width of 2, so if the number of seconds is, for example, 6, then it should display as 06.

Let's try with h:mm:ss. It will display the number of hours padded to a width of 1, the number of minutes padded to a width of 2, and the number of seconds padded to a width of 2; example: "0:12:05"

Language Features

Times support all default language features, including time suffixes.

Example

+

The time acts the same as a regular integer, but with extra features for display.

Limits

Time values have the same limits as integers; limited to -2^31 to 2^31 - 1. If you overflow a time by making it exceed these limits, it will wrap back around into the negatives/positives depending on which way you overflowed.

Display

When displayed to a player, times are formatted based on the _timeformat preprocessor variable. This variable is a string using lettering and colons to describe how the time should be divided, and where zeros should be inserted.

Time Format

The default time format is m:ss. This implies that the number of minutes should be displayed (m), and the number of seconds should be displayed after it (s). The two s's indicate that they should be padded to always have a width of 2, so if the number of seconds is, for example, 6, then it should display as 06.

Let's try with h:mm:ss. It will display the number of hours padded to a width of 1, the number of minutes padded to a width of 2, and the number of seconds padded to a width of 2; example: "0:12:05"

Language Features

Times support all default language features, including time suffixes.

Example

define time timeRemaining timeRemaining = 1m + 30s timeRemaining -= 7s @@ -45,4 +45,4 @@ ‎ print "Time Remaining: {timeRemaining}" // Time Remaining: 01:23 -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/using-colors.html b/mccompiled/docs/using-colors.html index f5b48e2..1101a99 100644 --- a/mccompiled/docs/using-colors.html +++ b/mccompiled/docs/using-colors.html @@ -1,9 +1,9 @@ -Using Colors | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Using Colors

In writing any Minecraft commands that include text which will be shown to the player, you always have the option to use the section symbol § and a color code to decorate text with colors and formatting.

This formatting is not very informative, but you can use a feature in MCCompiled called definitions to improve the way colors are laid out in text.

definitions.def

In the MCCompiled installation directory, you can view the file called definitions.def to view all definitions shipped with the compiler. The file is composed of CATEGORYs, each with a set of entries where <key> IS <value>. The entries for the chat colors look like this:

+}

MCCompiled Wiki 1.18.1 Help

Using Colors

In writing any Minecraft commands that include text which will be shown to the player, you always have the option to use the section symbol § and a color code to decorate text with colors and formatting.

This formatting is not very informative, but you can use a feature in MCCompiled called definitions to improve the way colors are laid out in text.

definitions.def

In the MCCompiled installation directory, you can view the file called definitions.def to view all definitions shipped with the compiler. The file is composed of CATEGORYs, each with a set of entries where <key> IS <value>. The entries for the chat colors look like this:

CATEGORY COLOR AND CHATCOLOR AND CHAT COLOR BLACK IS §0 DARKBLUE IS §1 @@ -63,12 +63,12 @@ RESET IS §r NONE IS §r 0 IS §r -

Multiple category names are defined, and most possible variants of color names are covered. To get the entry for black, you could refer to it as color: black, chatcolor: black, chat color: black, etc.

Specifying a Definition

Definitions are evaluated first, before every other process of the compiler. The text contained within a definition is evaluated the same way raw code would be if it were written. Definitions just provide a convenient and verbose way to specify code which has little meaning.

To specify a definition in your code, wrap it in square brackets and provide the category name as well as the entry name.

+

Multiple category names are defined, and most possible variants of color names are covered. To get the entry for black, you could refer to it as color: black, chatcolor: black, chat color: black, etc.

Specifying a Definition

Definitions are evaluated first, before every other process of the compiler. The text contained within a definition is evaluated the same way raw code would be if it were written. Definitions just provide a convenient and verbose way to specify code which has little meaning.

To specify a definition in your code, wrap it in square brackets and provide the category name as well as the entry name.

[category: entry] -

Example for Chat Coloring

This is an example using the color category to style text.

+

Example for Chat Coloring

This is an example using the color category to style text.

// read by the compiler as "§cYou don't have permission!" print "[color: red]You don't have permission!" -

Specifying Multiple Definitions

After specifying a category, you may specify multiple values under that category, separated by commas. The values will be concatenated together, without a space in between them.

+

Specifying Multiple Definitions

After specifying a category, you may specify multiple values under that category, separated by commas. The values will be concatenated together, without a space in between them.

// read by the compiler as "§l§aYou don't have permission!" print "[color: bold, green]Added {gold} gold!" -

Escaping Definitions

If you don't wish for a definition to be parsed, you can precede it with a backslash \ to cancel definition on that token. If two backslashes are specified, they'll cancel out, and you will end up with a single backslash before the definition is parsed as usual.

The following table shows the results of different backslash counts to illustrate this idea:

Backslash #

Input

Output

0 (even)

[color: red]

§c

1 (odd)

\[color: red]

[color: red]

2 (even)

\\[color: red]

\§c

3 (odd)

\\\[color: red]

\[color: red]

4 (even)

\\\\[color: red]

\\§c

Last modified: 24 April 2024
\ No newline at end of file +

Escaping Definitions

If you don't wish for a definition to be parsed, you can precede it with a backslash \ to cancel definition on that token. If two backslashes are specified, they'll cancel out, and you will end up with a single backslash before the definition is parsed as usual.

The following table shows the results of different backslash counts to illustrate this idea:

Backslash #

Input

Output

0 (even)

[color: red]

§c

1 (odd)

\[color: red]

[color: red]

2 (even)

\\[color: red]

\§c

3 (odd)

\\\[color: red]

\[color: red]

4 (even)

\\\\[color: red]

\\§c

Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/docs/values.html b/mccompiled/docs/values.html index 9ec29d9..ed95e88 100644 --- a/mccompiled/docs/values.html +++ b/mccompiled/docs/values.html @@ -1,9 +1,9 @@ -Values | MCCompiled Wiki

MCCompiled Wiki 1.18 Help

Values

Values are the backbone of all runtime logic. Values are just scoreboard objectives under the hood, but their representation in MCCompiled is much different. There are a couple of key differences about values:

  1. Values act identical to variables in other programming languages.

    • Regular math operations: a + b

    • Compound assignment: a += b

    • Declaration: define int a

  2. Values can have types.

  3. Values have no length restrictions on names.

  4. Values are formatted when displayed to a player.

Defining Values

Defining a value is done using the syntax define [type] [name]. The most common type is int, short for integer. An integer can be any whole number between -2147483648 and 2147483647. It's versatile, and is the closest to a Minecraft scoreboard objective.

+}

MCCompiled Wiki 1.18.1 Help

Values

Values are the backbone of all runtime logic. Values are just scoreboard objectives under the hood, but their representation in MCCompiled is much different. There are a couple of key differences about values:

  1. Values act identical to variables in other programming languages.

    • Regular math operations: a + b

    • Compound assignment: a += b

    • Declaration: define int a

  2. Values can have types.

  3. Values have no length restrictions on names.

  4. Values are formatted when displayed to a player.

Defining Values

Defining a value is done using the syntax define [type] [name]. The most common type is int, short for integer. An integer can be any whole number between -2147483648 and 2147483647. It's versatile, and is the closest to a Minecraft scoreboard objective.

define int score -

Assigning Values

To assign something to a value, use the assignment = symbol. By default, the assignment always happens to the executing entity, @s. If you want to change which entity gets the value assigned, see clarification.

+

Assigning Values

To assign something to a value, use the assignment = symbol. By default, the assignment always happens to the executing entity, @s. If you want to change which entity gets the value assigned, see clarification.

score = 0 -

Values can be assigned to other values as well; notice that the difference between scoreboard operation and scoreboard set is abstracted away entirely.

+

Values can be assigned to other values as well; notice that the difference between scoreboard operation and scoreboard set is abstracted away entirely.

define bonus bonus = 10 score = bonus -

Merging Define and Assignment (and type omission)

If you wish to combine an assignment and a definition into one line, you can do that! Specify the assignment just after the define command is completed. When merging definition/assignment, you can omit the type if you want, as it will be inferred from the value you're assigning.

The following two examples have identical behavior. Note that in the second example, the type int is omitted because the compiler can tell what type 'number' should be based on the input 21.

+

Merging Define and Assignment (and type omission)

If you wish to combine an assignment and a definition into one line, you can do that! Specify the assignment just after the define command is completed. When merging definition/assignment, you can omit the type if you want, as it will be inferred from the value you're assigning.

The following two examples have identical behavior. Note that in the second example, the type int is omitted because the compiler can tell what type 'number' should be based on the input 21.

define int example example = 21
define example = 21 -

Initializing Values

If you're familiar with scoreboard objectives in Minecraft, you may know that score-holders may not have any score at all. Not 0, but nothing at all. You can use the init command to initialize a value so that if a score-holder doesn't hold it, the value will be set to the default (usually 0).

+

Initializing Values

If you're familiar with scoreboard objectives in Minecraft, you may know that score-holders may not have any score at all. Not 0, but nothing at all. You can use the init command to initialize a value so that if a score-holder doesn't hold it, the value will be set to the default (usually 0).

init example -

Simple Math

All the math operations in MCCompiled are listed here:

No Compound Assignment

Adds the left and right values.


+

Simple Math

All the math operations in MCCompiled are listed here:

No Compound Assignment

Adds the left and right values.


define a = 10 define b = 4 define result ‎ result = a + b assert result == 14 -

Subtracts the right value from the left value.


+

Subtracts the right value from the left value.


define a = 10 define b = 4 define result ‎ result = a - b assert result == 6 -

Multiplies the left and right values.


+

Multiplies the left and right values.


define a = 10 define b = 4 define result ‎ result = a * b assert result == 40 -

Divides the left value by the right value.


+

Divides the left value by the right value.


define a = 10 define b = 4 define result ‎ result = a / b assert result == 2 -

Divides the left value by the right value, but returns the remainder.


+

Divides the left value by the right value, but returns the remainder.


define a = 10 define b = 4 define result ‎ result = a % b assert result == 2 -

Compound Assignment

When you need the left value to store the result of the operation, you can use what is called compound assignment. Compound assignment is specified by using an equals-sign = after the operator you wish to use.

With Compound Assignment

Adds the right value to the left value.


+

Compound Assignment

When you need the left value to store the result of the operation, you can use what is called compound assignment. Compound assignment is specified by using an equals-sign = after the operator you wish to use.

With Compound Assignment

Adds the right value to the left value.


define a = 10 define b = 4 ‎ a += b assert a == 14 -

Subtracts the right value from the left value.


+

Subtracts the right value from the left value.


define a = 10 define b = 4 ‎ a -= b assert a == 6 -

Multiplies the left value with the right value.


+

Multiplies the left value with the right value.


define a = 10 define b = 4 ‎ a *= b assert a == 40 -

Divides the left value by the right value.


+

Divides the left value by the right value.


define a = 10 define b = 4 ‎ a /= b assert a == 2 -

Divides the left value by the right value, but sets the left value to the remainder.


+

Divides the left value by the right value, but sets the left value to the remainder.


define a = 10 define b = 4 ‎ a %= b assert a == 2 -

Complex Statements

MCCompiled fully supports the use of operations inline, as well as PEMDAS ordering. Using inline operations keeps code size way down, and communicates its purpose much more clearly than separating operations per-line.

The order that MCCompiled evaluates complex statements mostly conforms to PEMDAS along with some extra steps added for the other features in the language:

  1. Evaluate everything inside parentheses recursively. () []

  2. Run any dereferences. $

  3. Run function calls. name(...)

  4. Apply any indexers. [...]

  5. Evaluate multiplication/division operations. a * b

  6. Evaluate addition/subtraction operations. a - b

The following example shows the use of a complex statement to calculate the amount of score remaining until a player reaches the next level of a theoretical game:

+

Complex Statements

MCCompiled fully supports the use of operations inline, as well as PEMDAS ordering. Using inline operations keeps code size way down, and communicates its purpose much more clearly than separating operations per-line.

The order that MCCompiled evaluates complex statements mostly conforms to PEMDAS along with some extra steps added for the other features in the language:

  1. Evaluate everything inside parentheses recursively. () []

  2. Run any dereferences. $

  3. Run function calls. name(...)

  4. Apply any indexers. [...]

  5. Evaluate multiplication/division operations. a * b

  6. Evaluate addition/subtraction operations. a - b

The following example shows the use of a complex statement to calculate the amount of score remaining until a player reaches the next level of a theoretical game:

define int untilNextLevel define int betweenLevels = 1000 untilNextLevel = ((score / betweenLevels + 1) * betweenLevels) - score -

Clarification

By default, values point to @s, or the executing entity. This default works for a majority of cases; however, when you need to change who the value points to, clarifiers are the answer.

A clarifier is defined as a selector encased in square brackets (indexers). For example, a clarifier pointing to all cows would look like [@e[type=cow]], and one pointing to the nearest non-self player would look like [@p[rm=0.1]].

The following example shows adding one to losses for all players with the tag 'touched'

+

Clarification

By default, values point to @s, or the executing entity. This default works for a majority of cases; however, when you need to change who the value points to, clarifiers are the answer.

A clarifier is defined as a selector encased in square brackets (indexers). For example, a clarifier pointing to all cows would look like [@e[type=cow]], and one pointing to the nearest non-self player would look like [@p[rm=0.1]].

The following example shows adding one to losses for all players with the tag 'touched'

losses[@a[tag=touched]] += 1 -

Other ways of doing the above example

Miscellaneous Operations

Some operations don't follow the rules of the five main math operations, those of which are listed here. None of the operations listed here are mentioned as assignment or not, they just exist as-is.

Miscellaneous Operations

Swaps the left and right values.


+

Miscellaneous Operations

Some operations don't follow the rules of the five main math operations, those of which are listed here. None of the operations listed here are mentioned as assignment or not, they just exist as-is.

Miscellaneous Operations

Swaps the left and right values.


define a = true define b = false ‎ a >< b assert a == false assert b == true -

Attributes

Attributes can change the way values behave. Any number of attributes can be applied pretty much anywhere in the definition; before or after the type. See attributes for all attributes across the language.

global

Makes the attached value global, meaning that the value's scoreboard objectives are always tied to the global fakeplayer _.


Any attempts to use clarifiers on the value will result in a compile-time error. The value is guaranteed to never be attached to an entity.

Examples & Use-case

Making values global is useful for anything that applies to the world, and not a specific player/entity. If you were designing a mini-game, for example, you would want the game-related code to be global, along with the compile-time guarantees that it will remain global.

+

Attributes

Attributes can change the way values behave. Any number of attributes can be applied pretty much anywhere in the definition; before or after the type. See attributes for all attributes across the language.

global

Makes the attached value global, meaning that the value's scoreboard objectives are always tied to the global fakeplayer _.


Any attempts to use clarifiers on the value will result in a compile-time error. The value is guaranteed to never be attached to an entity.

Examples & Use-case

Making values global is useful for anything that applies to the world, and not a specific player/entity. If you were designing a mini-game, for example, you would want the game-related code to be global, along with the compile-time guarantees that it will remain global.

define global int playersPassed define global time timeRemaining ‎ function display { globalprint "PASSED: {playersPassed} | TIME LEFT: {timeRemaining}" } -
bind

Binds the value to a given MoLang query. Requires one parameter, being a string that contains the query to use. The current list of supported bindings is here.


Most bindings come with pre-defined entities they attach to, but in cases where they don't, the entities can be manually specified by adding more string parameters to the end of the function, i.e., bind("query.is_sleeping", "fox") to bind specifically to foxes.

Examples & Use-case

Binding replaces all cases where animation controllers were needed to access extra information about entities.

+
bind

Binds the value to a given MoLang query. Requires one parameter, being a string that contains the query to use. The current list of supported bindings is here.


Most bindings come with pre-defined entities they attach to, but in cases where they don't, the entities can be manually specified by adding more string parameters to the end of the function, i.e., bind("query.is_sleeping", "fox") to bind specifically to foxes.

Examples & Use-case

Binding replaces all cases where animation controllers were needed to access extra information about entities.

define bool bind("query.is_sleeping") isSleeping ‎ if not isSleeping { summon lightning_bolt print @a "{@s} IS RUINING THE SMP!!!" } -
Last modified: 24 April 2024
\ No newline at end of file +
Last modified: 10 May 2024
\ No newline at end of file diff --git a/mccompiled/monaco/mcc-monarch.js b/mccompiled/monaco/mcc-monarch.js index 9a52b3d..9168754 100644 --- a/mccompiled/monaco/mcc-monarch.js +++ b/mccompiled/monaco/mcc-monarch.js @@ -2,7 +2,7 @@ const mccompiled = { operators: [ `<`, `>`, `{`, `}`, `=`, `(`, `)`, `+`, `-`, `*`, `/`, `%`, `!` ], selectors: [ `@e`, `@a`, `@s`, `@p`, `@r` ], preprocessor: [ `$add`, `$append`, `$assert`, `$call`, `$dec`, `$div`, `$else`, `$if`, `$inc`, `$include`, `$iterate`, `$json`, `$len`, `$log`, `$macro`, `$mean`, `$median`, `$mod`, `$mul`, `$pow`, `$prepend`, `$repeat`, `$reverse`, `$sort`, `$strfriendly`, `$strlower`, `$strupper`, `$sub`, `$sum`, `$swap`, `$unique`, `$var` ], - commands: [ `actionbar`, `assert`, `await`, `clear`, `damage`, `define`, `dialogue`, `dummy`, `effect`, `else`, `execute`, `explode`, `face`, `lookat`, `feature`, `fill`, `for`, `function`, `fn`, `give`, `globalactionbar`, `globalprint`, `globaltitle`, `halt`, `if`, `init`, `initialize`, `kill`, `lang`, `mc`, `command`, `cmd`, `move`, `particle`, `playsound`, `print`, `remove`, `repeat`, `replace`, `return`, `rotate`, `say`, `scatter`, `setblock`, `tag`, `test`, `throw`, `title`, `tp`, `teleport`, `while` ], + commands: [ `actionbar`, `assert`, `await`, `clear`, `damage`, `define`, `dialogue`, `dummy`, `effect`, `else`, `execute`, `explode`, `face`, `lookat`, `feature`, `fill`, `for`, `function`, `fn`, `give`, `globalactionbar`, `globalprint`, `globaltitle`, `halt`, `if`, `init`, `initialize`, `kill`, `lang`, `mc`, `command`, `cmd`, `move`, `particle`, `playsound`, `print`, `remove`, `repeat`, `replace`, `return`, `rotate`, `say`, `scatter`, `setblock`, `summon`, `tag`, `test`, `throw`, `title`, `tp`, `teleport`, `while` ], literals: [ `true`, `false`, `not`, `and`, `null`, `~`, `^` ], types: [ `int`, `decimal`, `bool`, `time`, `struct`, `ppv`, `global`, `local`, `extern`, `export`, `bind`, `auto`, `partial`, `async` ], comparisons: [ `until`, `count`, `any`, `block`, `blocks`, `positioned` ], @@ -52,55 +52,55 @@ const mccompiled = { const mcc_operators = [ { word: `<`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `>`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `{`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `}`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `=`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `(`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `)`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `+`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `-`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `*`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `/`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `%`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, { word: `!`, - docs: 'No documentation available for v1.18.' + docs: 'No documentation available for v1.19.' }, ] const mcc_selectors = [ @@ -432,6 +432,10 @@ const mcc_commands = [ word: `setblock`, docs: `Sets the block at a specific position, optionally using a replace mode.` }, + { + word: `summon`, + docs: `Summons an entity; matches Minecraft vanilla syntax.` + }, { word: `tag`, docs: `Add and remove tags from the given entity.`