Vector provider

Provides vectors for item effects

Context vector provider

Provides a vector from the item effect context based on the 'key' field, either coming from the trigger, the providers in the data object of the effect or added from some other outcome or provider.

Format:
typetetra:context
keystring

The key of a vector in the item effect context.

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

Context vector provider shorthand

Shorthand for the context vector provider using a single string referencing a vector in the effect context.

Format:
string
Example values:
target
source

Shorthand for the context vector provider using a single string referencing a vector in the effect context.

Examples:
"target"
"source"

Number vector provider

Allows the construction of a vector from three number providers.

Format:
typetetra:number
xNumber provider

Will be used for the x component of the vector.

yNumber provider

Will be used for the y component of the vector.

zNumber provider

Will be used for the z component of the vector.

Example:
{
  "type": "tetra:number",
  "x": 1,
  "y": {
    "type": "tetra:effect_level",
    "effect": "bleeding"
  },
  "z": {
    "type": "tetra:sum",
    "values": [
      {
        "type": "tetra:vector",
        "vector": "target",
        "field": "y"
      },
      1
    ]
  }
}

Number vector provider shorthand

Shorthand for the number vector provider, which is an array of three number providers rather than a typed object with three fields.

Format:
array[
Number provider
Number provider
Number provider
]
Example:
[
  {
    "type": "tetra:vector",
    "vector": "target",
    "field": "x"
  },
  64,
  "a + 4"
]

Entity facing vector provider

Provides the facing of the given entity, with some optional parameters.

Format:
typetetra:entity_facing
entityEnitity provider

The entity to get the facing of.

cardinaloptionalItem effect condition

If true the provider returns the facing vector of the nearest cardinal direction, defaults to false.

onlyHorizontaloptionalItem effect condition

If true the provider only returns facing along the horizontal plane, defaults to false.

Example:
{
  "type": "tetra:entity_facing",
  "entity": "target"
}

Entity motion vector provider

Provides the motion vector of the given entity.

Format:
typetetra:entity_motion
entityEnitity provider

The entity to get the motion of.

Example:
{
  "type": "tetra:entity_motion",
  "entity": "target"
}

Entity position vector provider

Provides the position of the given entity.

Format:
typetetra:entity_position
entityEnitity provider

The entity to get the position of.

Example:
{
  "type": "tetra:entity_position",
  "entity": "target"
}

Expression vector provider

Allows number expressions to be used (in number vector providers) based on the vectors (and numbers) in the context, as well as the 'vectors' and 'numbers' objects on this provider. Values from a vector can be accessed in an expression by affixing the key used for the vector with X, Y or Z. E.g. to access the X coordinate for a vector keyed 'player' is done using 'playerX' in an expression. Expressions in the values object can reference values that are defined earlier than that expression. The result field is the vector that will be returned from this provider.

Format:
typetetra:expression
vectorsoptional
map[
string
:
Vector provider
]

All vectors listed here will be added to the context before numerical context values are generated from vectors.

numbersoptional
map[
string
:
Number provider
]

Numbers listed here will be added to the context before the result field is calculated. Numerical context values generated from context vectors are available to providers listed in this object.

resultVector provider

The provider will return this vector, the number shorthand vector provider will be preferred here in most cases.

Example:
{
  "type": "tetra:expression",
  "vectors": {
    "facing": {
      "type": "tetra:entity_facing",
      "entity": "miner"
    }
  },
  "numbers": {
    "distance": {
      "type": "tetra:effect_efficiency",
      "effect": "ravenous"
    }
  },
  "result": [
    "minerX + facingX * distance",
    "minerY + facingY * distance",
    "minerZ + facingZ * distance"
  ]
}

Normalize vector provider

Normalizes a vector, making it have a length of 1.

Format:
typetetra:normalize
vectorEnitity provider

The vector that is to be normalized.