Enchantment Definition
Defines a custom enchantment
Поля
| Поле | Тип | По умолчанию | Описание | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enchantmentLore | String | — | Lore shown on items for this enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nameColor | String | gray | Color of the enchantment name on items (MiniMessage tag, e.g. 'gray' or '#aaaaaa') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
supportedItems | List<Material> | empty | Items that support this enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
anvilCost | Int | 1 | Cost in an anvil to combine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maxLevel | Int | 1 | Maximum level of the enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weight | Int | 1 | Weight used for random selection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
minimumCost | Cost | — | Minimum cost when enchanting
|
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
base | Int | 0 | — |
perLevel | Int | 0 | — |
maximumCostCostCost (2)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
base | Int | 0 | — |
perLevel | Int | 0 | — |
activeSlotsList<EnchantSlot>emptyANYHANDMAINHANDOFFHANDARMORHEADCHESTLEGSFEETBODYexclusiveWithList<Ref<RegisteredEnchantment>>emptyCustomEnchantmentDefinitionEnchantmentDefinitionCustomEnchantmentDefinition (14)
| Поле | Тип | По умолчанию | Описание | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
displayName | String | — | Display name of the enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
enchantmentLore | String | — | Lore shown on items for this enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nameColor | String | gray | Color of the enchantment name on items (MiniMessage tag, e.g. 'gray' or '#aaaaaa') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
supportedItems | List<Material> | empty | Items that support this enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
anvilCost | Int | 1 | Cost in an anvil to combine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maxLevel | Int | 1 | Maximum level of the enchantment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weight | Int | 1 | Weight used for random selection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
minimumCost | EnchantmentDefinition.Cost | — | Minimum cost when enchanting
|
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
displayName | String | — | Display name of the enchantment |
enchantmentLore | String | — | Lore shown on items for this enchantment |
nameColor | String | gray | Color of the enchantment name on items (MiniMessage tag, e.g. 'gray' or '#aaaaaa') |
supportedItems | List<Material> | empty | Items that support this enchantment |
anvilCost | Int | 1 | Cost in an anvil to combine |
maxLevel | Int | 1 | Maximum level of the enchantment |
weight | Int | 1 | Weight used for random selection |
minimumCost | Cost | — | Minimum cost when enchanting |
maximumCost | Cost | — | Maximum cost when enchanting |
activeSlots | List<EnchantSlot> | empty | Equipment slots the enchantment is active in (empty = armor + hands)Значения:ANYHANDMAINHANDOFFHANDARMORHEADCHESTLEGSFEETBODY |
exclusiveWith | List<Ref<RegisteredEnchantment>> | empty | Enchantments that cannot coexist with this one on the same item |
treasureChance | Int | 0 | Chance (0-100%) for this enchantment to appear as a book in generated loot chests |
tradeChance | Int | 0 | Chance (0-100%) for librarian villagers to sell this enchantment instead of a vanilla book trade |
cooldownEnabled | Boolean | true | Whether active triggers use a cooldown |
cooldown | Duration | ofSeconds(1) | Cooldown between active triggers |
criteria | List<Criteria> | empty | Criteria that must match for triggers to run |
inactiveTriggers | List<Ref<TriggerableEntry>> | empty | Triggers fired when the enchantment becomes inactive |
activeTriggers | List<ActiveTriggers> | empty | Triggers fired while the enchantment is active. Each entry specifies the level. |
maximumCostEnchantmentDefinition.CostEnchantmentDefinition (18)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
displayName | String | — | Display name of the enchantment |
enchantmentLore | String | — | Lore shown on items for this enchantment |
nameColor | String | gray | Color of the enchantment name on items (MiniMessage tag, e.g. 'gray' or '#aaaaaa') |
supportedItems | List<Material> | empty | Items that support this enchantment |
anvilCost | Int | 1 | Cost in an anvil to combine |
maxLevel | Int | 1 | Maximum level of the enchantment |
weight | Int | 1 | Weight used for random selection |
minimumCost | Cost | — | Minimum cost when enchanting |
maximumCost | Cost | — | Maximum cost when enchanting |
activeSlots | List<EnchantSlot> | empty | Equipment slots the enchantment is active in (empty = armor + hands)Значения:ANYHANDMAINHANDOFFHANDARMORHEADCHESTLEGSFEETBODY |
exclusiveWith | List<Ref<RegisteredEnchantment>> | empty | Enchantments that cannot coexist with this one on the same item |
treasureChance | Int | 0 | Chance (0-100%) for this enchantment to appear as a book in generated loot chests |
tradeChance | Int | 0 | Chance (0-100%) for librarian villagers to sell this enchantment instead of a vanilla book trade |
cooldownEnabled | Boolean | true | Whether active triggers use a cooldown |
cooldown | Duration | ofSeconds(1) | Cooldown between active triggers |
criteria | List<Criteria> | empty | Criteria that must match for triggers to run |
inactiveTriggers | List<Ref<TriggerableEntry>> | empty | Triggers fired when the enchantment becomes inactive |
activeTriggers | List<ActiveTriggers> | empty | Triggers fired while the enchantment is active. Each entry specifies the level. |
activeSlotsList<EnchantSlot>emptyANYHANDMAINHANDOFFHANDARMORHEADCHESTLEGSFEETBODYexclusiveWithList<Ref<RegisteredEnchantment>>emptytreasureChanceInt0tradeChanceInt0mechanicsList<EnchantmentMechanic>emptyEnchantmentMechanic (6)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
event | EnchantmentEvent | PLAYER_ATTACK | The event that triggers this mechanicЗначения:PLAYER_ATTACKPLAYER_DEFENDBLOCK_BREAKBOW_SHOOTPROJECTILE_HITITEM_CONSUMEPLAYER_DEATHPLAYER_INTERACTARMOR_EQUIPITEM_DAMAGEFALL_DAMAGEENVIRONMENTAL_DAMAGEPLAYER_MOVESHIELD_BLOCKSNEAKSPRINT |
criteria | List<Criteria> | empty | Conditions that must be met to execute the actions |
actions | List<Ref<TriggerableEntry>> | empty | Actions executed when criteria are met |
clientSideEffects | List<Ref<TriggerableEntry>> | empty | Client-side only effects (particles, sounds) executed via packets |
runOnLevel | Int | 0 | Level required to run this mechanic. 0 means all levels. |
chance | Int | 100 | Chance to trigger this mechanic (0-100%). |
EnchantmentDefinition (18)
| Поле | Тип | По умолчанию | Описание | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
displayName | String | — | Display name of the enchantment | ||||||||||||
enchantmentLore | String | — | Lore shown on items for this enchantment | ||||||||||||
nameColor | String | gray | Color of the enchantment name on items (MiniMessage tag, e.g. 'gray' or '#aaaaaa') | ||||||||||||
supportedItems | List<Material> | empty | Items that support this enchantment | ||||||||||||
anvilCost | Int | 1 | Cost in an anvil to combine | ||||||||||||
maxLevel | Int | 1 | Maximum level of the enchantment | ||||||||||||
weight | Int | 1 | Weight used for random selection | ||||||||||||
minimumCost | Cost | — | Minimum cost when enchanting
|
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
base | Int | 0 | — |
perLevel | Int | 0 | — |
maximumCostCostCost (2)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
base | Int | 0 | — |
perLevel | Int | 0 | — |
activeSlotsList<EnchantSlot>emptyANYHANDMAINHANDOFFHANDARMORHEADCHESTLEGSFEETBODYexclusiveWithList<Ref<RegisteredEnchantment>>emptytreasureChanceInt0tradeChanceInt0cooldownEnabledBooleantruecooldownDurationofSeconds(1)criteriaList<Criteria>emptyinactiveTriggersList<Ref<TriggerableEntry>>emptyactiveTriggersList<ActiveTriggers>emptyActiveTriggers (2)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
level | Int | 1 | — |
triggers | List<Ref<TriggerableEntry>> | empty | — |
treasureChanceInt0tradeChanceInt0cooldownEnabledBooleantruecooldownDurationofSeconds(1)inactiveTriggersList<Ref<TriggerableEntry>>emptyactiveTriggersList<ActiveTriggers>emptyActiveTriggers (2)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
level | Int | 1 | — |
triggers | List<Ref<TriggerableEntry>> | empty | — |
Общие поля TypeWriter (displayName, criteria)
| Поле | Тип | По умолчанию | Описание |
|---|---|---|---|
displayName | String | — | Display name of the enchantment |
criteria | List<Criteria> | empty | Criteria that must match for triggers to run |
How to use it
This is the trigger-based definition. Use it when you want to run TypeWriter entries while the enchantment is worn or held, rather than react to game events. For event-driven effects, use Custom Enchantment Definition.
- Identity:
nameandidbuild the registry keytypewriter:<name>(lower-case, spaces become underscores). The enchantment is also registered under itsid. Avoid renaming an enchantment once items carry it.displayNameandnameColor(a MiniMessage color such asgray,#aaaaaa, or a full tag such as<gradient:red:gold>) set how it is shown. - Items and slots:
supportedItemslists the materials that can carry it.activeSlotslimits where it is active; empty means armor and hands. - Enchanting:
maxLevel,anvilCost,minimumCostandmaximumCost(baseplusperLevel) shape the enchanting table and anvil. In the table,weightis the percentage chance (0 to 100) of being offered, and0removes it from the table. - World:
treasureChanceandtradeChanceare percentages for generated loot chests and librarian trades. - Exclusivity:
exclusiveWithlists enchantments that cannot be on the same item. This is enforced in the anvil. - Behaviour:
activeTriggersruns the listed entries for the current level (one list per level; the level must match exactly). WithcooldownEnabled, they repeat everycooldownwhile the enchantment stays active.inactiveTriggersruns when it stops.criteriamust match for either to run.