Client-side mod that calculates optimal enchantment paths to save XP and levels when enchanting gear, tools, weapons, and armor.
Enchantment Calculator is a client-side mod that helps you find the most cost-effective way to combine enchantments on your items.
This mod is based on the functionality provided by this website
This mod supports customization via a custom resource pack. GUI elements are located at:assets/enchantmentcalculator/textures/gui
You can view the original textures in the source code on GitHub
If you have an idea to improve the interface by redrawing the elements or by changing the code, I would appreciate it.
Found a bug, errors in calculations, have a suggestion? Please report it my our GitHub Issues page.
The Enchantment Calculator uses a sophisticated tree-based optimization algorithm to find the most cost-effective enchanting sequence.
For n enchantments, generate all possible binary combination trees
- Each leaf = enchantment book or base item
- Each internal node = anvil combination operation
- Tree depth determines maximum prior work penalty
The mod calculates costs using Minecraft's exact anvil mechanics:
Total Cost = Enchantment Cost + Prior Work Penalty
Where:
MULTIPLIERS[left_uses] + MULTIPLIERS[right_uses][1023]Instead of testing all possible trees, the algorithm:
For each tree structure:
1. Sort enchantment books by cost (expensive first)
2. Calculate leaf contribution values for each position
3. Place expensive items at positions with lowest contributions
4. Minimize total weighted cost
Supports two optimization targets:
penalty = MULTIPLIERS[left_item_uses] + MULTIPLIERS[right_item_uses]
if (levels ≤ 16): xp = levels² + 6×levels
if (levels ≤ 31): xp = 2.5×levels² - 40.5×levels + 360
if (levels > 31): xp = 4.5×levels² - 162.5×levels + 2220
For each tree position i:
contribution[i] = depth_from_root
weighted_sum = Σ(i × contribution[i])
The mod uses empirically determined weights matching Minecraft's internal costs:
Weight 1: protection, sharpness, efficiency, unbreaking, power
Weight 2: fire_aspect, looting, fortune, punch, flame
Weight 4: mending, silk_touch, infinity, curse_of_binding
This algorithm ensures you get the mathematically optimal enchanting sequence while maintaining fast performance suitable for real-time gameplay.