概览
附魔计算器(Enchantment Calculator)是一个客户端模组,帮助你找到合并物品附魔时最具性价比的方案。
本模组基于 该网站 提供的功能开发。
本模组支持通过自定义资源包进行定制。GUI 元素位于:
assets/enchantmentcalculator/textures/gui
你可以在 GitHub 上的源代码中查看原始纹理。
如果你有关于通过重绘元素或更改代码来改进界面的想法,我将不胜感激。
自 2.0 更新以来:
- 重新设计了 GUI
- 自动附魔功能
- 改进了计算算法 + 添加了通过经验值优化的方法
- 添加了“使用书”功能,可自动从你的库存中提取书本并将其附魔添加到计算器中
- 支持 26.x 版本
- 为自动附魔添加了预设支持
重要提示!!!!! 在使用自动附魔功能之前,请务必获得服务器管理员的批准。否则,请使用 公平玩法版。
Bug 报告与功能请求
发现了错误、计算出错或有建议?请在我们的 GitHub Issues 页面上报告。
使用方法
- 将物品放入 铁砧
- 从左侧面板选择 附魔
- 点击计算 以找到最佳顺序
- 按照右侧面板显示的步骤操作
- 使用箭头按钮 浏览步骤
截图
主界面
预设界面
技术算法概览
优化算法
附魔计算器使用复杂的基于树的优化算法来寻找最具性价比的附魔序列。
核心算法步骤:
1. 树结构生成
对于 n 个附魔,生成所有可能的二叉组合树
- 每个叶节点 = 附魔书或基础物品
- 每个内部节点 = 铁砧合并操作
- 树的深度决定了最大先前工作惩罚
2. 成本计算模型
模组使用 Minecraft 的确切铁砧机制来计算成本:
总成本 = 附魔成本 + 先前工作惩罚
其中:
- 附魔成本:基于附魔稀有度权重
- 先前工作惩罚:
MULTIPLIERS[left_uses] + MULTIPLIERS[right_uses] - 乘数:
[1023]
3. 树剪枝优化
与其测试所有可能的树,算法会:
- 按最大深度(铁砧使用次数)对树进行分组
- 计算每棵树的加权贡献总和
- 仅保留每个深度级别的最佳树
- 将复杂度从 O(n!) 降低到 O(n²)
4. 物品放置优化
对于每种树结构:
1. 按成本对附魔书排序(昂贵的优先)
2. 计算每个位置的叶节点贡献值
3. 将昂贵物品放置在贡献最低的位置
4. 最小化总加权成本
5. 多模式优化
支持两种优化目标:
- 等级模式:最小化总铁砧等级成本
- 经验模式:最小化总经验值消耗
数学基础
先前工作惩罚计算:
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
树贡献加权:
对于每个树位置 i:
contribution[i] = depth_from_root
weighted_sum = Σ(i × contribution[i])
算法复杂度
- 时间复杂度:O(n² × 2^n),其中 n = 附魔数量
- 空间复杂度:O(n × 2^n),用于存储树
- 实际性能:典型情况下的 5-7 个附魔 <100ms
附魔权重系统
模组使用经验确定的权重,与 Minecraft 的内部成本相匹配:
Weight 1: protection, sharpness, efficiency, unbreaking, power
Weight 2: fire_aspect, looting, fortune, punch, flame
Weight 4: mending, silk_touch, infinity, curse_of_binding
树搜索策略
- 生成 所有可能的二叉树结构
- 过滤 最大深度以减少搜索空间
- 评分 每棵树使用加权贡献分析
- 选择 每个深度级别的最佳树
- 测试 每棵选定树的物品放置
- 返回 全局最优解
边缘情况处理
- 单个附魔:直接应用(成本 = 权重 × 等级)
- 两个附魔:简单合并,无需树搜索
- 不兼容的附魔:在选择阶段被过滤掉
- 最大铁砧使用次数:限制为 6 次使用(成本 = 1023 级)
该算法确保你获得数学上最优的附魔序列,同时保持适合实时游戏的快速性能。
Overview
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.
Since 2.0 update:
- reworked gui
- auto-enchantment function
- improved calculate algorithm + added way to optimize by xp
- added a "Use Book" feature that automatically takes books from your inventory and adds their enchantments to the calculator
- 26.x support
- added preset support for auto-enchantment
IMPORTANT!!!!! Before using the auto-enchantment feature, please get approval from your server admins. Otherwise, use the fair play edition
Bug Reports & Feature Requests
Found a bug, errors in calculations, have a suggestion? Please report it my our GitHub Issues page.
Usage
- 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 through steps using arrow buttons
Screenshots
Main gui
Preset gui
Technical Algorithm Overview
Optimization Algorithm
The Enchantment Calculator uses a sophisticated tree-based optimization algorithm to find the most cost-effective enchanting sequence.
Core Algorithm Steps:
1. Tree Structure Generation
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
2. Cost Calculation Model
The mod calculates costs using Minecraft's exact anvil mechanics:
Total Cost = Enchantment Cost + Prior Work Penalty
Where:
- Enchantment Cost: Based on enchantment rarity weights
- Prior Work Penalty:
MULTIPLIERS[left_uses] + MULTIPLIERS[right_uses] - Multipliers:
[1023]
3. Tree Pruning Optimization
Instead of testing all possible trees, the algorithm:
- Groups trees by maximum depth (anvil use count)
- Calculates weighted contribution sums for each tree
- Keeps only the best tree per depth level
- Reduces complexity from O(n!) to O(n²)
4. Item Placement Optimization
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
5. Multi-Mode Optimization
Supports two optimization targets:
- Level Mode: Minimizes total anvil level cost
- Experience Mode: Minimizes total XP expenditure
Mathematical Foundation
Prior Work Penalty Calculation:
penalty = MULTIPLIERS[left_item_uses] + MULTIPLIERS[right_item_uses]
Experience Cost Conversion:
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
Tree Contribution Weighting:
For each tree position i:
contribution[i] = depth_from_root
weighted_sum = Σ(i × contribution[i])
Algorithm Complexity
- Time Complexity: O(n² × 2^n) where n = number of enchantments
- Space Complexity: O(n × 2^n) for tree storage
- Practical Performance: <100ms for typical 5-7 enchantments
Enchantment Weight System
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
Tree Search Strategy
- Generate all possible binary tree structures
- Filter by maximum depth to reduce search space
- Score each tree using weighted contribution analysis
- Select optimal trees per depth level
- Test item placements for each selected tree
- Return globally optimal solution
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 (cost = 1023 levels)
This algorithm ensures you get the mathematically optimal enchanting sequence while maintaining fast performance suitable for real-time gameplay.
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
下载 Enchantment Calculator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧