90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!

0.8.0 (1.21)

Changelog

What's New:

User Changes:

  • Added ?. and ? null safe operators.
    • ?. Used on structures. Same as ., but returns null if there's no such field in structure.
    • ? Used with anything that can be null. Returns the right operand if left is null or left if not.

These operators allow you to quickly check for nulls in your expressions. Let's image a situation like this:

You have a variable struct.x which might not exist and maybe null. Before, you'd have to write something like this:

if(structContainsKey(struct, 'x') && struct.x != null, struct.x, valueElse())'

Now this can be shortened to: struct?.x ? valueElse(). Do note that ? has a very low precedence, so in ambiguous cases you'll have to wrap it in parentheses. e.g. 23 + struct?.x ? 23 -> 23 + (struct?.x ? 23).

  • Java Optionals are now unwrapped in expressions.
  • Minecraft Identifiers are now converted to strings in expressions.
  • Gson elements can now be used in expressions.

Dev Changes:

  • Fixed equals on CustomDataAccessors.
  • Added LootContext as an argument for the CustomFields#addVirtualField function.

Other Changes:

  • Updated mEvalEx to fix expression inlining.

Files

commander-0.8.0-1.21-build.22.jar(884.94 KiB) Primary Download
commander-0.8.0-1.21-build.22-sources.jar(101.63 KiB) Download

Project members

constellation

constellation

Organization

melontini

Author

Details

Licensed MIT
Published 5 months ago
Updated a month ago