Skip to content

Releases: Energyxxer/Trident-Language

v1.4.2

26 Jan 22:22
Compare
Choose a tag to compare

Trident-Language v1.4.2 Changelog:

  • Fixed CLI compiler not adding configured feature map to list of loaded feature maps, thus causing certain language features behaving according to the default feature map. (#5)

v1.4.1

15 Jan 16:17
Compare
Choose a tag to compare

Trident-Language v1.4.1 Changelog:

  • Fixed entity default health using pre-1.16 attribute name and causing compilation errors under some settings.
  • Fixed "invalid resource location" NBT error not showing the erroneous value in the error message.
  • Fixed NPE when passing null to set command target via interpolation block

v1.4.0

02 Oct 16:54
Compare
Choose a tag to compare

Trident-Language v1.4.0 Changelog:

  • Added new item command syntax and text component separators
  • UUIDs now coerce into entities
  • File library now read files from dependencies if not found in compiled project
  • Added File.in.delete and Reflection.getFunctionContents functions
  • Implemented Predicate changes from 1.16 and 1.17
  • Added concatenation of NBT paths with variable-target pointers
  • Compile-only files no longer report non-appending commands (i.e. plugin commands with only instructions)
  • Added the ability for plugin syntax files to define and use global pattern variables when name is prefixed by GLOBAL__
  • storeFlat now takes an optional second argument: the delimiter to place between each token.

  • Fixed a memory leak that made summaries keep references to previous summaries, if using cache
  • Fixed a memory leak that made all the data from a compilation stick around in memory after compilation finished until next compilation

  • Fixed dependencies not using the compiler's cache
  • Fixed trailing string throwing exception when on last line
  • Fixed exception when creating a generic object in a field initializer
  • Fixed default Random constructor being hidden
  • Fixed set command treating > and < operators as *=
  • Fixed set command not accepting the swap operator
  • Fixed functions in input data pack not being callable
  • Fixed trailing string capturing carriage return
  • Fixed using instruction failing for entities that snap to grid
  • Fixed Random.nextInt(int) throwing exception on calls
  • Fixed unhelpful exception when passing a value of the wrong type to a raw execute modifier
  • Fixed exception when a method multiple overloads has a pointer as an argument
  • Fixed plugin commands that return built-in patterns corrupting their evaluator
  • Fixed resolveListMatch not being a registered member of nbt_path
  • Fixed dictionary keys not unescaping single-quote strings
  • Fixed plugins unable to parse gamemode, gamerule and structure IDs
  • Fixed plugin commands throwing error when storing an omitted optional pattern
  • Fixed tags from input still exporting the raw file instead of exporting through the Tag object
  • Fixed NBT Path compound filter consuming interpolation blocks after whitespace
  • Fixed interpolation blocks for NBT compounds not checking type
  • Fixed native library and dependencies running more than once for each dependency that uses it
  • Fixed Tags.createTag unable to create function tags with non-tag contents
  • Fixed Tags.createTag unable to create function references
  • Fixed recessive function in syntax files not working

v1.3.3

20 Apr 01:40
Compare
Choose a tag to compare

Trident-Language v1.3.3 Changelog:

  • Fixed items in commands discarding the count even when count is not 1
  • Fixed exception when an item is used in a particle parameter
  • Fixed resource pack exportables from dependencies not being exported
  • Fixed generics sometimes throwing an exception when deeply nested
  • Fixed some binary and hexadecimal integer literals being parsed as floating point numbers
  • Various improvements to memory allocation and performance

v1.3.2

14 Mar 15:02
Compare
Choose a tag to compare

Trident-Language v1.3.2 Changelog:

  • Fixed exception that occurred when exporting a pack with a folder that had a dot in its name.

v1.3.1

12 Mar 19:33
Compare
Choose a tag to compare

Trident-Language v1.3.1 Changelog:

  • Fixed symbols not being verified in types and interpolation variables

v1.3.0

12 Mar 18:58
Compare
Choose a tag to compare

Trident-Language v1.3.0 Changelog:

Classes

  • Generic classes: Classes can now have type parameters, which can be resolved on instantiation. Example:
define class TypedList<T> {
    # wraps a private list
    # interface limits elements to the type T
    
    private var list : list = []

    public add(element : T) {
        eval list.add(element)
    }
}

var intList : TypedList<int> = new TypedList<int>()

eval intList.add(5) # OK
eval intList.add("5") # ERROR

var stringList : TypedList<string> = new TypedList<string>()

eval stringList.add("5") # OK
eval stringList.add(5) # ERROR
  • Classes can now override getIterator (similarly to toString) to return something that is iterable (e.g. a list, a dictionary or another iterable class object), for use in foreach loops

  • Classes can now have get-set properties. Similar to C#, and are defined almost identically to indexers:

define class TypedList<T> {
    private var list : list

    public length {
        get : int {
            return list.length
        }
    }
}
  • New class method modifier: virtual. When used on methods, it will resolve any clashes with other inherited methods by picking the other method instead of throwing an error. Use this for methods which you intend other classes to overwrite.

  • (Possibly breaking change): Overloaded functions will now favor overloads with parameters whose types can be coerced to over parameters with no constraints.

Operators

  • Conditional Ternary Operator: a ? b : c. Evaluates b if a is true, c otherwise. This is a short-circuiting operator, so the wrong branch won't be evaluated.

  • Operator Overloading: Classes are now able to overload any operator for any combination of types.

  • Null coalescing operator: ??. Evaluates the left side. If the left side evaluates to null, it then returns the right side. This is a short-circuiting operator, so the right side won't be evaluated if the left is not null.

  • Null-propagation: ? before a member access will abort the evaluation of the right side if the left side is null, and resolve the entire expression to null. Example:

var testFunction = function(arg : function?, loc : resource?) {
    eval arg?()
    var namespace = loc?.namespace
    # if loc is null, namespace is also null
}

Syntax

  • Named function parameters: You can now pass parameters to functions in any order by writing the name of a parameter before it. Example:
var testFunction = function(a : int, b : string) {
    log info "a: " + a
    log info "b: " + b
}

eval testFunction(b: "foo", a: 5)

Commands and Minecraft Updates

  • Added item command (for 1.17+ targeting projects)

  • Replaceitem now outputs the equivalent item command if the target version is 1.17+

  • Added code action to convert replaceitem command to item command (and vice versa)

  • Added code actions for making variables final and constraining to initialization type.

Native Library

  • New method: File.in.write(inPath : string, content : string). Writes a file back into the input project directory

  • New method: File.in.exists(inPath : string). Returns whether the file at the given input path exists

  • New method: File.in.isDirectory(inPath : string). Returns whether the file at the given input path exists and is a directory

  • New method: File.in.wasFileChanged(inPath : string). Returns whether the file at the given path was changed since the last successful compilation

  • New method: Reflection.getCurrentFilePath(). Returns the file path of the current file, from the project root directory (not to be confused with getCurrentFile which returns the resource location of the function)

  • New list method: reduce(function : function, initialValue). Reduces the list to a single value by iteratively applying the given function.

  • New dictionary method: hasOwnProperty(key : string). Returns true if the dictionary has a value associated with the given key

Expected Types

  • Ints and booleans are now allowed in blockstate value interpolation blocks
  • The throw instruction can now re-throw exceptions

Output

  • The output data pack format is now automatically set to the value corresponding to the target version
  • Fixed JSON.stringify escaping HTML characters
  • Fixed Tag.createTag not marking default tags for export

Trident-UI Integration

  • Added suggestions for both static and instance members of a class, using information from type constraints. Supports inheritance, meaning it can suggest fields from classes it extends.
  • this inside classes now suggests members of that class.
  • Added suggestions for primitive data type members
  • Variable names that cannot be resolved are now highlighted with an error.
    Note: deprecated functions such as typeOf and isInstance are shown as errors but still work.

v1.2.1

16 Aug 17:45
Compare
Choose a tag to compare

Trident-Language v1.2.1 Changelog:

Commands and Minecraft Updates

  • Added setworldspawn and spawnpoint command angle parameter (1.16)
  • Projects targeting 1.16 or later can now have any biome ID in parameters expecting a biome, now that custom biomes are possible
  • Added optional tag value support for both data pack input and Tag library

Plugins

  • Added STATS parsing mode for ANONYMOUS_INNER_FUNCTION in plugins

Literals

  • Text component literals now accept all JSON primitives. This also means numbers as text components are now output as-is without any truncation of leading or trailing zeros.
  • Pointer literals will no longer attempt to create the objective on pointer creation, only on use

Fixes

  • Fixed native get-set symbols not setting (e.g. all pointer, item and block members)
  • Fixed pointer data type not having a type handler
  • Fixed contents in hoverEvent being parsed as content
  • Fixed give command count having an upper limit
  • Fixed exception on tag_float and tag_double constructors
  • Fixed execute commands being duplicated
  • Fixed errors in Shared.Location.block() and Shared.Location.fluid()
  • Fixed @Breaking files not breaking on exceptions inside loops
  • Fixed some exceptions not being caught and re-thrown correctly as command exceptions
  • Fixed duplicate sub-symbols in file summaries

v1.2.0

24 Jun 20:33
Compare
Choose a tag to compare

Trident-Language v1.2.0 Changelog:

New Type System

  • Custom user-defined Classes: Create your own compile-time type definitions
    ~ Define fields, methods (with overloads), both statically and for instances
    ~ Indexers and cast/coercion definitions
    ~ Class inheritance

  • Type constraints: Make variables, parameters and return values enforce a specific type

  • Added final variables: Any attempt to set their value after the first time fails.

  • New ways of checking types of values:
    ~ type_definition.of() for retrieving the type of a value (typeOf is now deprecated in favor of this method)
    ~ type_definition.is() method and is operator for checking if a value is an instance of a type (instanceOf is now deprecated in favor of these)

  • Added as operator, which allows casting that returns null if an error occurs during casting.

Native and Standard Libraries

  • All standard and native libraries have been changed to Classes
    ~ The API is still the same, but they're now proper classes with methods as opposed to dictionaries

  • Added Project native library for checking the target version and available Minecraft features.

  • Added native Random class
    ~ Used to generate random numbers
    ~ The Random.PROJECT_RANDOM object is seeded with a constant seed for your project, meaning it will return consistent values every compilation

  • Added Integer.parseUnsignedInt() and Integer.toUnsignedString() methods to the native Integer class.

  • Added isInOpenWater method to Predicate class

  • Player-specific predicates are now placed under a "player" sub-object for projects targeting 1.16 and above

Primitive Types and Literals

  • New primitives: Rotation, UUID, Type Definition

  • Added bit shift operators << and >>

  • Added shorthand bitwise operator assignment |=, ^=, ^=, <<= and >>=

  • Added hex and binary integer literals by using the prefix 0x and 0b respectively.

  • Numbers can now be coerced into ranges.

  • Added engineering notation for real number literals
    ~ Given a base, followed by e+ or e- and an exponent for a power of ten. e.g. 1.5e+3 resolves to 1500.0

Commands

  • Added attribute and locatebiome commands for projects targeting 1.16 or above

  • Dimensions in commands can now be any resource location for projects targeting 1.16 or above

  • Spreadplayers now accepts an under argument for projects targeting 1.16 or above

  • Text components can now accept font arguments and hex color values for projects targeting 1.16 or above

  • Allowed noop at the end of execute commands to unambiguously exclude a command

  • Added if/unless <selector> execute modifier, which is shorthand for if/unless entity <selector>

Syntax

  • The do keyword in do if compile-time conditionals has been made optional.
    ~ An open parenthesis after the if will always be inferred to be a compile-time conditional as opposed to an execute conditional.

  • Un-reserved all keywords

Exceptions

  • Fixed exceptions not breaking when inside a function call
    ~ It used to default the return value to null when an exception occurred, now the exception should bubble up the call stack

  • Added @breaking file directive. Makes the file halt processing on the first uncaught exception; particularly useful for files with lots of compile-time (eval) processing.

  • Stack trace elements in standard library files now show a more descriptive message.

Plugins

  • Plugin commands are now namespaced by the plugin name.
    ~ Use the new @using_plugin file directive to import all the commands in a plugin to use without a namespace in the current file.

~ The property "using-all-plugins" must be specified and set to false in .tdnproj for namespacing to be necessary.
~ This means existing projects will automatically import all plugins into all files for backwards compatibility.
~ It is recommended that you set "using-all-plugins" to false when you create a new project (Trident-UI will do this) and only import when necessary.

  • Fixed recursive plugin commands failing to store variables
  • Fixed execute command not accepting custom plugin commands.

Changes to how Trident projects are compiled:
~ Projects now require a second configuration file to compile: .tdnbuild
~ This file will contain information about which resources the compiler should use (definition packs, feature maps, type maps, plugin name aliases, etc.), where the output should be and what it should do with it.
~ .tdnproj will remain for project-specific information such as aliases, target version, dependencies, etc.
~ This change is mainly to separate what's intrinsic to the project and what is likely to change when you share the project with others, move it to another directory or even another computer.

Changes to the command line interface:
~ All arguments except the project root have been removed.
~ A new (optional) argument has been added which should be the path to the .tdnbuild file to use. If omitted, this defaults to whatever .tdnbuild file is directly inside the project root.

Other

  • Fixed some file readers not releasing locks on files.

v1.1.3

09 Apr 21:17
Compare
Choose a tag to compare

v1.1.3 Changelog:

  1. Added 'eval' within item and entity declarations
  2. Added Reflection.getSymbol() function, used to retrieve a symbol with the given string as its name from the current context
  3. Added Reflection.getVisibleSymbols() function, used to get a dictionary with all the symbols (variables) visible from the context that called it
  4. Added Reflection.getDefinedObjectives() function, used to retrieve a dictionary with information about all currently defined objectives
  5. Allowed lists of components in entity implements and new entity literals
  6. Added 'crafted' default item event support
  7. Implemented better error handling for invalid tags
  8. Fixed team join and team leave outputting as a living-entity instead of a score-holder
  9. Fixed living-entity names escaping unicode characters
  10. Fixed top-most stack trace element not printing its location in the file
  11. NBTTM now allows root types to refer to not just compounds, but also primitive types
  12. Fixed NBT analysis not expanding root types at the end of a path