Repository navigation
Enchanting Mechanics
This page describes which items and enchantments the Advanced Enchantment Table accepts, and how the experience cost is calculated.
An item can be placed in the enchanting slot when it is:
- enchantable in vanilla terms,
- already enchanted,
- a Book, or
- an Enchanted Book,
and it is not blacklisted in the configuration. The slot holds one item at a time.
The table iterates over every enchantment registered in the world's enchantment registry and offers an enchantment when:
- it is not blacklisted,
- the item supports that enchantment (
ItemStack#supportsEnchantment), and - it is not a treasure enchantment, or it is a curse during a full-moon night, or the table is in daylight above a valid precious-material floor (see below).
The final list is passed through the AvailableEnchantmentsEvent, so mods can add or remove entries. See API.
A treasure enchantment is offered when either:
- it is a curse and the current night is a full-moon night near midnight, or
- it is daytime and the 3 × 3 blocks directly beneath the table are all in the
minecraft:beacon_base_blockstag.
"Near midnight" means the world's time of day is between 0.40 and 0.60 and the moon phase is full (phase 0). In the interface, such a night is also indicated by the enchant button using a bone icon.
The availability rule gives curses a special case: a curse that is also tagged as treasure is accepted during a full-moon night near midnight. Curses have a higher cost (see the curse factor below), and reducing or removing a curse is charged as if applying the removed levels.
The cost is calculated per enchantment and per number of new levels. For each enchantment:
cost = baseCost × max(11 − weight, 1) × newLevels × costFactor
Then:
- if the enchantment is a curse,
costis multiplied bycurseFactor; - otherwise, if it is a treasure enchantment,
costis multiplied bytreasureFactor.
weight is the enchantment's data-driven weight, newLevels is the number of levels being added above the item's original level, and the other values come from the configuration. Each individual result is passed through the EnchantmentCostEvent, which can change it (see API).
Only levels above the item's original level are charged. Lowering or removing a non-curse enchantment costs nothing and gives no experience back. Lowering a curse is charged.
The table's enchantment power is calculated from the valid bookshelf positions around it, using the same placement rules as the vanilla enchanting table. Each vanilla bookshelf provides 1 power. Each Decorative Book provides the configured floatingBookPower (1.0 by default).
The total cost is reduced by 1% per point of enchantment power:
finalCost = cost − cost × power / 100
The discount shown in the interface is capped at 30, while the cost calculation uses the full power of all valid bookshelf positions.
- The cost is measured in experience points, not experience levels.
- Survival players must have at least the full cost; otherwise the enchantment is not applied.
- Creative players pay nothing and can enchant without experience.
- Applying enchantments replaces the item's enchantment set with the selected one and then recalculates the interface state.
Enchanter's Bench is an unofficial port of Enchanting Plus (LGPL-3.0) by lclc98, Xkyouchoux, odininon and GnRSlash, maintained by Darkhax, with contributions from Jaredlll08, Shadows-of-Fire and translators. It is licensed under LGPL-3.0-or-later and is not affiliated with or endorsed by the original authors.