Enchantment Calculator
What is this mod?
Enchantment Calculator is a client-side mod that helps find the most cost-effective way to apply enchantments to your items in Minecraft.
How to use
- Place an item in the anvil
- Select enchantments from the left panel
- Click "Calculate" to find the optimal sequence
- Follow the steps shown in the right panel
- Navigate between steps using arrow buttons
Interface customization
The mod supports customization through custom resource packs. Interface elements are located at:
assets/enchantmentcalculator/textures/gui
Technical algorithm features
Tree-based optimization
The mod uses a sophisticated tree-based optimization algorithm to find the most efficient enchantment sequence.
Cost calculation
The mod accurately calculates costs according to Minecraft's anvil mechanics:
Total cost = Enchantment cost + Prior work penalty
Enchantment weight system
Weight 1: protection, sharpness, efficiency, unbreaking, power
Weight 2: fire aspect, looting, fortune, punch, flame
Weight 4: mending, silk touch, infinity, curse of binding
Performance optimization
Instead of testing all possible trees, the algorithm:
- Groups trees by maximum depth
- Calculates weighted contribution sums for each tree
- Keeps only the best tree per depth level
- Reduces complexity from O(n!) to O(n²)
Optimization modes
- Level mode: Minimizes total level cost
- Experience mode: Minimizes total XP consumption
Edge case handling
- Single enchantment: Direct application (cost = weight × level)
- Two enchantments: Simple combination without tree search
- Incompatible enchantments: Filtered during selection phase
- Maximum anvil uses: Capped at 6 uses
Known issues
- Interface overflows off-screen when using UI scale 4
This algorithm guarantees mathematically optimal enchantment sequence while maintaining high performance for real-time gameplay.