Custom Enchantment Definition
Type: custom_enchantment_definition
Tags: custom_enchantment_definition
Defines a custom enchantment with modular mechanics rather than cooldown-based triggers. Unlike enchantment_definition, this entry uses EnchantmentMechanic to compose behaviors from multiple game events.
When to Use
| Use Case | Entry Type |
|---|---|
| Cooldown-based active triggers | enchantment_definition |
| Modular mechanics (multi-event, chance, levels) | custom_enchantment_definition |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
id | String | "" | Unique identifier for this entry |
name | String | "" | Internal name |
displayName | String | "" | Display name shown in GUIs |
enchantmentLore | String | "" | Lore line added to items (supports MiniMessage colors) |
nameColor | String (MiniMessage tag) | "gray" | Color of the enchantment name. Uses MiniMessage syntax (e.g. gray, gold, #ff5555) |
supportedItems | List<Material> | [] | Item types that can receive this enchantment |
anvilCost | Int | 1 | XP levels required to combine in an anvil |
maxLevel | Int | 1 | Maximum obtainable level |
weight | Int | 1 | Rarity weight for random selection |
minimumCost | Cost | {} | Minimum cost when enchanting (see below) |
maximumCost | Cost | {} | Maximum cost when enchanting (see below) |
activeSlots | List<EnchantSlot> | [] | Equipment slots the enchantment is active in (ANY, HAND, MAINHAND, OFFHAND, ARMOR, HEAD, CHEST, LEGS, FEET, BODY). Empty means armor + hands |
exclusiveWith | List<Ref<RegisteredEnchantment>> | [] | Enchantments that cannot coexist with this one on the same item (enforced in the anvil) |
treasureChance | Int | 0 | Chance (0-100%) to appear as a book in generated loot chests |
tradeChance | Int | 0 | Chance (0-100%) for librarian villagers to sell this enchantment |
mechanics | List<EnchantmentMechanic> | [] | Modular mechanics for this enchantment |
Cost
| Field | Type | Default | Description |
|---|---|---|---|
base | Int | 0 | Base cost |
perLevel | Int | 0 | Cost per level |
Mechanic
See Enchantment Mechanic for the full mechanic configuration.
Example
{
"id": "vampiric_strike",
"name": "Vampiric Strike",
"displayName": "<dark_red>Vampiric Strike",
"nameColor": "dark_red",
"supportedItems": ["DIAMOND_SWORD", "NETHERITE_SWORD", "NETHERITE_AXE"],
"maxLevel": 5,
"anvilCost": 3,
"weight": 3,
"minimumCost": { "base": 10, "perLevel": 5 },
"maximumCost": { "base": 20, "perLevel": 8 },
"mechanics": [
{
"event": "PLAYER_ATTACK",
"actions": ["enchantment_creator:lifesteal_action"],
"runOnLevel": 0,
"chance": 100
}
]
}