▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Commander
Commander

Commander

An extension of the data pack system.

72.2K
11

0.9.0 (1.21)

beta6 августа 2024 г.

What's New:

User Changes:

  • Added the (data pack) expression library!

This feature allows adding common expressions to a library where each is identified using an Identifier.

{
  "replace": false, // Can be omitted.
  "expressions": {
    "test:cool_expression": "score * 2.5",
    "test:boolean_expression": "level.isDay && !level.isRaining"
  }
}

Later on, these expressions can be evaluated inside other expressions using the library container, like so:

sqrt(library.my_id:some_value) * library.my_id:other_value

Or in execute/scoreboard brigadier commands using cmd:library. Prefer using the library in Brigadier commands! It does not require parsing the expression in-place!

  • Brigadier macros in JSON commands should now correctly fail on dangling braces.

Dev Changes:

  • Added more javadoc to the api package.
  • Removed evalex and mapping-io from pom.xml
  • Added LongExpression. Similar to Arithmetica and BooleanExpression, but for longs!
  • Tried to fix expression equality.
  • Added missing 'parameter' methods to Arithmetica, BooleanExpression and BrigadierMacro.
  • Added Expression.Result#NULL.

Other Changes:

  • The mod should now fail with slightly better error messages.
  • Inlined constant BooleanExpression instances.

0.9.0 (1.20.1)

beta6 августа 2024 г.

What's New:

User Changes:

  • Added the (data pack) expression library!

This feature allows adding common expressions to a library where each is identified using an Identifier.

{
  "replace": false, // Can be omitted.
  "expressions": {
    "test:cool_expression": "score * 2.5",
    "test:boolean_expression": "level.isDay && !level.isRaining"
  }
}

Later on, these expressions can be evaluated inside other expressions using the library container, like so:

sqrt(library.my_id:some_value) * library.my_id:other_value

Or in execute/scoreboard brigadier commands using cmd:library. Prefer using the library in Brigadier commands! It does not require parsing the expression in-place!

  • Brigadier macros in JSON commands should now correctly fail on dangling braces.

Dev Changes:

  • Added more javadoc to the api package.
  • Removed evalex and mapping-io from pom.xml
  • Added LongExpression. Similar to Arithmetica and BooleanExpression, but for longs!
  • Tried to fix expression equality.
  • Added missing 'parameter' methods to Arithmetica, BooleanExpression and BrigadierMacro.
  • Added Expression.Result#NULL.

Other Changes:

  • The mod should now fail with slightly better error messages.
  • Inlined constant BooleanExpression instances.

0.8.0 (1.21)

alpha28 июля 2024 г.

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.

0.8.0 (1.20.4)

beta28 июля 2024 г.

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.

0.8.0 (1.20.1)

beta28 июля 2024 г.

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.

Совместимость

Minecraft: Java Edition

1.21.x1.20.x

Платформы

Поддерживаемые окружения

Сервер

Создатели

Детали

Лицензия:MIT
Опубликован:2 года назад
Обновлён:1 год назад
Главная