Item effect condition

Various conditions that can be used to determine what to do depending on the state of the game.

Fixed item effect condition

Either always passes or always fails.

Format:
typetetra:fixed
valueboolean

The condition passes if this is set to true.

Example:
{
  "type": "tetra:fixed",
  "value": true
}

Fixed item effect condition shorthand

Shorthand for the fixed item effect condition, using a boolean value instead of a typed object.

Format:
boolean

Shorthand for the fixed item effect condition, using a boolean value instead of a typed object.

Example:
true

Expression item effect condition

An item effect condition that is based on a comparative mathematical expression, additional numerical data may be passed to the expression.

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

Number providers can be added here to be made available to the expression. Will merge with the numbers from the context, providers in this map will override numbers in the context with the same key.

expressionstring
Example values:
numbers.a > numbers.b
numbers.a + numbers.b == numbers.c

Must contain a single comparator (>, <, >=, <=, ==, !=) with an expression (same as for numbers) on both sides.

And item effect condition

Passes if ALL of the given conditions pass.

Format:
typetetra:and
conditions
array[
Item effect condition
]

All conditions in this array must pass for this condition to pass.

Example:
{
  "type": "tetra:and",
  "conditions": [
    {
      "type": "tetra:fixed",
      "value": true
    },
    {
      "type": "tetra:fixed",
      "value": false
    }
  ]
}

Or item effect condition

Passes if ANY of the given conditions pass.

Format:
typetetra:or
conditions
array[
Item effect condition
]

At least one condition in this array must pass for this condition to pass.

Example:
{
  "type": "tetra:or",
  "conditions": [
    {
      "type": "tetra:fixed",
      "value": true
    },
    {
      "type": "tetra:fixed",
      "value": false
    }
  ]
}

Not item effect condition

Passes if the given condition does NOT pass.

Format:
typetetra:not
conditionItem effect condition

The parent condition passes if this condition does not.

Example:
{
  "type": "tetra:not",
  "condition": {
    "type": "tetra:fixed",
    "value": false
  }
}

Block item effect condition

Tests if the block at the given position passes the given condition.

Format:
typetetra:block
positionVector provider

The position of the block that is to be tested.

blockProperty matcher

Tests properties of the block, the condition passes if this passes.

Example:
{
  "type": "tetra:block",
  "position": "target",
  "block": {
    "tag": "forge:ores"
  }
}

Can harvest item effect condition

Tests if the block at the given position can be harvested with the item the effect is sourced from.

Format:
typetetra:can_harvest
positionVector provider

The position of the block that is to be tested.

Example:
{
  "type": "tetra:can_harvest",
  "position": "target"
}

Random item effect condition

A condition that has a chance (equal to the provided chance value) to pass.

Format:
typetetra:random
chanceNumber provider

Should return a number between 0 and 1 (values outside that range will work as well), a value of 0 (or less) would never pass and a value of 1 (or greater) would always pass.

Example:
{
  "type": "tetra:random",
  "chance": 0.3
}

Entities equals item effect condition

Tests if the two entities are the same.

Format:
typetetra:entities_equals
aEnitity provider

The first entity to compare.

bEnitity provider

The second entity to compare.

Example:
{
  "type": "tetra:entities_equals",
  "a": "attacker",
  "b": "target"
}

Entity item effect condition

Tests if the given entity passes the given condition(s).

Format:
typetetra:entity
entityEnitity provider

The entity to test.

conditionoptionalEntity predicate

An entity predicate used to test for different properties of the entity.

canFreezeoptionalItem effect condition

If provided, wheter or not the entity can freeze (entity can accumulate freezing ticks) needs to match this value.

isFreezingoptionalItem effect condition

If provided, wheter or not the entity is freezing (freezing ticks is > 0) needs to match this value.

isFrozenoptionalItem effect condition

If provided, wheter or not the entity is frozen (freezing ticks is above freezing limit) to match this value.

originoptionalVector provider

Used as a reference point for the optional 'distance' field in the condition, can be omitted if that's not used.

Example:
{
  "type": "tetra:entity",
  "entity": "target",
  "condition": {
    "type": "#minecraft:freeze_hurts_extra_types"
  }
}