Skip to main content

Contract Type

A Contract Type defines the rules of a contract between a player and a creature: who may be an owner, which creatures may be contracted, how the spirit beast follows and fights, and what happens when the contract is broken or the creature dies.

File Location

Contract Type JSON files go in data/<namespace>/mxt/contract_type/ within your data pack.

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

Fields

FieldTypeDefaultDescription
owner_conditionEntity Conditionmxt:always_trueThe owner condition.
creature_conditionEntity Conditionmxt:always_trueThe spirit beast condition.
follow_actionEntity Actionmxt:no_opThe follow behaviour.
combat_actionBiEntity Actionmxt:no_opThe combat behaviour.
break_actionEntity Actionmxt:no_opThe contract breaking behaviour.
penalty_actionEntity Actionmxt:no_opThe penalty for violating the contract or dying.

owner_condition is checked against the player and creature_condition against the creature that is being contracted. combat_action is a BiEntity Action, so it receives both the actor and the target entity; the other lifecycle fields are ordinary Entity Actions.

Example

{
"follow_action": { "type": "mxt:apply_effect", "effect": "minecraft:speed", "duration_ticks": 40 },
"combat_action": {
"type": "mxt:target_action",
"action": { "type": "mxt:set_on_fire", "ticks": 40 }
},
"break_action": { "type": "mxt:apply_effect", "effect": "minecraft:weakness", "duration_ticks": 200 },
"penalty_action": { "type": "mxt:set_on_fire", "ticks": 100 }
}

A contract type with an explicit owner condition:

{
"owner_condition": {
"type": "mxt:has_realm",
"resource": "example:spirit_power"
},
"creature_condition": {
"type": "mxt:always_true"
},
"follow_action": { "type": "mxt:apply_effect", "effect": "minecraft:speed", "duration_ticks": 40 },
"combat_action": {
"type": "mxt:target_action",
"action": { "type": "mxt:set_on_fire", "ticks": 40 }
},
"break_action": { "type": "mxt:apply_effect", "effect": "minecraft:weakness", "duration_ticks": 200 },
"penalty_action": { "type": "mxt:set_on_fire", "ticks": 100 }
}
note

The condition and action types above are examples; the complete list is in the Action Types and Condition Types references.