How to Use the Custom Enchantment Builder

  1. Set the enchantment’s ID, description, supported items (a tag like #minecraft:enchantable/sword or a specific item ID), slots, max level, and anvil/enchanting costs.
  2. Add one or more effect rows – each targets an effect slot (Damage, Armor Effectiveness, Knockback, Attributes, Post Attack, Hit Block) and defines either a constant value or a linear formula that scales with enchantment level.
  3. Copy the generated JSON and save it to your datapack at data/<namespace>/enchantment/<name>.json.

How Data-Driven Enchantments Work

Since Java Edition 1.21, custom enchantments are defined entirely through datapack JSON – no code required, no mod loader needed, just a properly-shaped file under an enchantment registry folder. Every enchantment JSON needs a description, which items it can go on (supported_items, usually an item tag), which equipment slots trigger it, level/cost curves, and an effects map keyed by effect slot. The Attributes slot is a special case worth calling out: unlike every other slot, its entries are flat {id, attribute, amount, operation} objects rather than being wrapped in an effect key – this builder handles that difference for you automatically. The Post Attack slot (for effects like “apply Poison on hit”) is also structurally different from a plain value effect, requiring an enchanted/affected pairing plus a requirements predicate gating it to direct hits.

Most numeric effect values support two modes: a flat constant, or a linear formula (base plus per_level_above_first) that scales automatically with the enchantment’s level – exactly how vanilla enchantments like Sharpness scale their bonus damage per level.

Frequently Asked Questions

Do I need a mod or plugin to add a custom enchantment?

No – this is a pure vanilla datapack feature since 1.21, requiring only a correctly-shaped JSON file in the right folder. No code, mod loader, or server plugin is needed; a datapack works on any vanilla server or singleplayer world running a compatible version.

Why does my Attributes effect look different in the JSON than a Damage effect?

Because it genuinely has a different schema – minecraft:attributes entries are flat objects with id, attribute, amount, and operation fields directly, while every other slot wraps its value inside a nested effect object. This isn’t a bug in the generated JSON; it reflects how the underlying game data actually expects that specific slot to be structured.

Can one enchantment have multiple effects on the same slot?

Yes – each effect slot maps to a list, so adding multiple rows targeting the same slot (say, two separate Damage effects) produces multiple entries in that slot’s array rather than overwriting each other.

Will this JSON work on every Minecraft version?

It targets the 1.21+ data-driven enchantment schema specifically. This system is still evolving release to release, so always verify field names against your exact target version before shipping a datapack – a schema that works on one 1.21.x release isn’t guaranteed to be byte-identical on the next.

Related Tools