Skip to main content

Conditional number

saturn:conditional

Checks entity conditions in order and uses the value of the first matching branch.

A NumberProvider can be written as a number, a formula string, or an object with a type from this section. Game-time fields default to ticks; 20 ticks is usually one second.

JSON fields​

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:conditional
branchesArray of branch objectsno[]Ordered conditional branches; each entry contains condition and value.
fallbackNumber or formula stringnoomittedFallback value used when there is no matching or known value.

branches entries​

FieldTypeRequiredDefaultDescription
conditionEntity conditionyes—Checked in order; the first matching branch takes effect.
valueNumber provideryes—Value of this branch.

JSON example​

{
"type": "saturn:conditional",
"branches": [
{
"condition": {
"type": "saturn:sneaking"
},
"value": 2
}
],
"fallback": 1
}

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.util.formula.number.Conditional. This page is based on the Codec in the current 26.1.2 source.