概览
附魔计算器是一个客户端模组,帮助你找到在物品上组合附魔的最具性价比的方案。
本模组基于 该网站 提供的功能开发。
本模组支持通过自定义资源包进行自定义。GUI 元素位于:
assets/enchantmentcalculator/textures/gui
你可以在 GitHub 上的源代码中查看原始纹理。
如果你有关于通过重绘元素或更改代码来改进界面的想法,我将不胜感激。
公平游玩版
此版本帮助你规划附魔,但将铁砧操作留给你自己。选择你想要的附魔,选择是保存等级还是经验值,然后按照屏幕上的步骤操作。使用书本会读取你背包中的附魔书并将其附魔添加到计算器中;它不会移动或使用这些书本。
此版本没有预设或自动附魔控制。模组不会点击物品栏槽位、将物品放入铁砧或替你取出结果。下面的自动附魔说明指的是普通版。
2.0 更新以来:
- 重新设计了 GUI
- 自动附魔功能(仅在 默认版本 中)
- 改进了计算算法 + 添加了按经验值优化的方法
- 添加了“使用书本”功能,自动从你的背包中取出书本并将其附魔添加到计算器中
- 支持 26.x
Bug 报告与功能请求
发现了 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.
Fair Play Edition
This edition helps you plan enchantments, but leaves the anvil work to you. Pick the enchantments you want, choose whether to save levels or XP, and follow the steps on screen. Use Books reads the enchanted books in your inventory and adds their enchantments to the calculator; it does not move or use the books.
There are no presets or auto-enchant controls in this edition. The mod does not click inventory slots, put items in the anvil, or take the result for you. The auto-enchantment notes below describe the regular edition.
Since 2.0 update:
- reworked gui
- auto-enchantment function (only in default version)
- 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
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
Screenshot
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 (Fair)
下载 Enchantment Calculator (Fair)
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Enchantment Calculator (Fair)
下载 Enchantment Calculator (Fair)
下载 Enchantment Calculator (Fair)
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧