Number provider

Provides numerical values for item effects

Context number provider

Provides a numerical value from the item effect context based on the 'key' field, either coming from providers in the data object of the effect or added from some other outcome or provider. Unless there is a need for a fallback value a context shorthand provider is the easier way to go.

Format:
typetetra:context
keystring

The key used for the lookup.

fallbackoptionalNumber provider

Fallback value if the context contains no value for the given key. Defaults to 0.

Example:
{
  "type": "tetra:context",
  "key": "damage"
}

Effect level number provider

Provides the level of the given effect.

Format:
typetetra:effect_level
effectstring

The effect to get the level of.

fallbackoptionalNumber provider

Fallback value if the item is broken or doesn't have the effect. Defaults to 0.

Example:
{
  "type": "tetra:effect_level",
  "effect": "howling"
}

Effect efficiency number provider

Provides the efficiency of the given effect.

Format:
typetetra:effect_efficiency
effectstring

The effect to get the efficiency of.

fallbackoptionalNumber provider

Fallback value if the item is broken or doesn't have the effect. Defaults to 0.

Example:
{
  "type": "tetra:effect_efficiency",
  "effect": "sweeping"
}

Entity data number provider

Provides a numerical value from persisted data on the given entity.

Format:
typetetra:entity_data
entityEnitity provider

The entity to get properties from.

keystring

The key for the data field to get from the entity.

defaultValueoptionalNumber provider

The value to return if the entity does not have the data field.

Example:
{
  "type": "tetra:entity_data",
  "key": "my_addon:effect_name_hit_count"
}

Entity property number provider

Provides a numerical property from the given entity.

Format:
typetetra:entity_property
entityEnitity provider

The entity to get properties from.

propertystring
Allowed values:
freezingTicks
frozenLimit
burningDuration
airSupply
maxAirSupply
fallDistance
health
maxHealth
armor
absorption

The property to get from the entity.

Example:
{
  "type": "tetra:entity_property",
  "entity": "target",
  "property": "health"
}

Expression number provider

Provides a numerical value based on an expression. Supports addition, subtraction, multiplication, division, and parentheses. Can use fixed numerical values, but can also source values from the context (by using variable names matching numbers in the context). A data object can be used to define additional variables to what's available across the entire item effect.

Format:
typetetra:expression
numbersoptional
map[
string
:
Number provider
]

A map of number providers, can be used to add additional numbers to the context of the expression.

expressionstring

A string representation of a mathematical expression.

Example:
{
  "type": "tetra:expression",
  "numbers": {
    "efficiency": {
      "type": "tetra:effect_efficiency",
      "effect": "bleeding"
    },
    "height": {
      "type": "tetra:vector",
      "field": "y"
    }
  },
  "expression": "(1 + efficiency) * height"
}

Expression number provider shorthand

Shorthand for the expression number provider, allows an expression string to be provided without a typed object.

Format:
string
Example values:
1 + 2 * b

Shorthand for the expression number provider, allows an expression string to be provided without a typed object.

Example:
"1 + 2 * b"

Length number provider

Provides the length of a vector, defaults to providing the square length as that's more performant.

Format:
typetetra:length
vectorVector provider

The vector that is to be measured.

squareoptionalItem effect condition

Defaults to true, can be set to false to get the actual length instead of the square length.

Time number provider

Provides some representation of time from the world of the triggering entity.

Format:
typetetra:time
propertyoptionalstring
Allowed values:
gameTime
dayTime
moonPhase

The type of time value to get. gameTime: the time in ticks since the world was created, dayTime: the time of the current day, in ticks . moonPhase: The current moon phase, as a value between 0 and 7 (inclusive).

Example:
{
  "type": "tetra:time"
}

Vector number provider

Provides a numerical value based on a vector component

Format:
typetetra:vector
vectorVector provider

The vector to get the component from.

fieldstring
Allowed values:
x
y
z

The vector component that's to be returned by the provider.

Random number provider

Provides a random number between the two given numbers.

Format:
typetetra:random
minNumber provider

The lower bound (inclusive) for the random value.

maxNumber provider

The upper bound (inclusive) for the random value.

gaussianoptionalItem effect condition

If set to true the random number will be generated using a gaussian distribution (as opposed to a uniform distribution).