Skip to main content

Ability

An ability defines an active, passive or triggered ability, including its resource costs, cooldown, availability condition and the behaviour it executes.

File Location

Ability files go in data/<namespace>/mxt/ability/ within your datapack.

The filename corresponds to its ID. For example, data/example/mxt/ability/fireball.json has the ID example:fireball.

Fields

FieldTypeDefaultDescription
abilityAbilityType objectrequiredBuilt-in ability type object; the object must contain a type dispatch key.
costsList<ResourceCost>[]Resources deducted before the ability executes.
cast_timeNumberProvider0Cast time.
cooldownNumberProvider0Cooldown.
componentsList<AbilityComponent>[]State components such as cooldown, charges, toggling and duration.
modifiersList<AttributeEntry>[]Passive vanilla attribute modifiers; an entry contains attribute, id, amount and operation, plus an optional value formula.
damage_conditionDamageConditionmxt:always_trueRestriction on damage triggers.
conditionEntityConditionmxt:always_trueCondition for the ability to be usable.
entity_actionEntityActionmxt:no_opBehaviour executed on the caster.
target_conditionBiEntityConditionmxt:always_trueTarget relation condition.
bi_entity_actionBiEntityActionmxt:no_opBehaviour executed on the caster and the target.
element_affinityHolderOrTag<element>[][]Element affinity markers of the ability.

ability.type

ability.type is an extensible built-in dispatch table, mxt:ability_type, with the built-in types empty, active, triggered, modifier, aura, channelled, composite and word. Two of these types change when behaviour is executed:

TypeExclusive FieldsBehaviour Execution Timing
mxt:channelledtick_interval (default 1), upkeep_costs (default [])Executes entity_action and the target behaviour once on activation, then once per tick_interval after the upkeep resources have been deducted successfully, until it is released or the upkeep fails. It is the only behaviour entry point of a sustained effect.
mxt:compositeabilities (required), all_required (default true)Does not execute behaviour itself; with all_required: false only the first ability in the list is executed, while with true the costs of every ability are submitted in list order and then the behaviour of each child ability is executed in turn.

The effects of mxt:channelled and mxt:composite are both produced through the same set of fields: entity_action applies to the caster, target_selector and bi_entity_action apply to the selected target, while the word type is a terminal payload that does not execute target behaviour any more.

Example

{
"ability": {
"type": "mxt:triggered",
"triggers": [{"type": "mxt:item_use"}]
},
"costs": [
{"id": "example:qi", "amount": "10 + level"}
],
"cooldown": 100,
"condition": {"type": "mxt:sneaking"},
"entity_action": {"type": "mxt:damage", "amount": "4 + level"}
}

A channelled ability that pays upkeep every 20 ticks:

{
"ability": { "type": "mxt:channelled", "tick_interval": 20, "upkeep_costs": [{"id": "example:qi", "amount": 1}] },
"entity_action": {"type": "mxt:add_resource", "resource": "example:qi", "amount": 2}
}

A top-level ability that should be a channelled ability released from the ability hotbar must use mxt:channelled as a child ability of mxt:composite: mxt:active and mxt:channelled are mutually exclusive single types, and only the child abilities of a composite ability become the active channel.

{
"ability": { "type": "mxt:composite", "abilities": ["example:meditate_channel"] },
"cooldown": 100
}
Server-authoritative

Numeric fields of abilities uniformly use NumberProvider. An ability must pass its condition and all resource costs before its behaviour is executed. Ability behaviour is handled on the server; the client hotbar only sends use and cancel requests.

Abilities can read the entity variables plus the ability and trigger variables (element_modifier, damage, target_health, …); see Formula Variables.