Skip to content

MCCompiled 1.16

Compare
Choose a tag to compare
@7UKECREAT0R 7UKECREAT0R released this 02 Feb 00:11
· 1 commit to main since this release
17d15c3

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.
These new methods are fully optimized, as I've pulled away from the array-based implementation of preprocessor variables and fully implemented them as space-conscious lists instead. There's almost no memory overhead with the new implementation.
• 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].
The dereference is implicit. Reason being that these two snippets have different meanings:
$variableName[...] dereference variableName and then index result.
variableName[...] index variableName and then dereference it.

Changes: $iterate Rework
Previously, the engine would iterate over any JSON arrays contained within the preprocessor variable. It was inconsistent and unexpected behavior. The new behavior has two types of input, and follows the same rules for both.
• If the identifier of a preprocessor variable is specified, it will now only iterate over its elements.
• Now iterates over JSON object property names if one is specified. Previously would error.
• To iterate over a JSON array/object, dereference an element of a preprocessor variable.

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.
• This means that doing $mul value 2 will multiply all values by 2, rather than just the first.
• Operations $strfriendly $strlower and $strupper now ignore non-string values.
$strfriendly formatting improved.
• Changed init file to not include project name, reserved "init" function name.
• Greatly improved $if to produce better comparisons more consistently.
• Displaying decimal values now appends missing 0s to the start of the number.
Previously would show 0.1 instead of 0.001, for example.
• 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.