Skip to main content

Comparison expression

saturn:compare

Compares two expressions and returns a boolean result.

An information expression only reads the PlayerView passed in. Raw numbers, strings and booleans can be used directly as constants; operand objects must have a type. See Player information.

JSON fields​

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:compare
operationEnum stringyes—Operation name; see the enum notes below for available values. Available values: eq, ne, lt, le, gt, ge.
leftExpressionyes—Left operand expression.
rightExpressionyes—Right operand expression.

JSON example​

{
"type": "saturn:compare",
"operation": "ge",
"left": 10,
"right": 5
}

This is a value to embed in the corresponding field, not a standalone loadable data pack file. The example: references in the examples must be replaced with defined entries.

Java entry point​

com.iafenvoy.saturn.data.information.expression.builtin.CompareExpression. This page is based on the Codec in the current 26.1.2 source.