时运附魔效果(Fortune Enchantment on LootBag)
基本信息
| 属性 | 值 |
|---|---|
| 来源物品 | 战利品袋 enhancedlootbags:lootbag(任意 metadata) |
| 触发条件 | 物品上存在**时运(Fortune)**附魔,读取 EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, pStack) |
| 等级枚举 | LootGroupsHandler.FortuneLevel:LV0 / LV1 / LV2 / LV3 |
| 附魔值 | 15(袋子 getItemEnchantability) |
| 生效前提 | 该组 CombineTrashGroup="true" 且 AllowFortuneBags=true |
| 本 mod 是否提供升级物品 | 否,时运是原版附魔,本 mod 只读取它 |
⚠️ 本 mod 没有升级物品(upgrade item)系统,也没有升级槽。时运附魔是唯一能给袋子带来的"强化",且它是原版附魔书产物,不是 EnhancedLootBags 的物品。
四级完整枚举
recalcWeightByFortune(pOldWeight, pFortuneLevel) 只作用于垃圾组(TrashGroup)的权重:
| 等级 | 枚举常量 | 垃圾权重计算 | 垃圾权重剩余 | 物品 tooltip |
|---|---|---|---|---|
| 0 | LV0(0) |
原值不变 | 100% | not_fortuned = 「§5You feel that a bit more “Fortune” might be a good idea…」 |
| 1 | LV1(1) |
w - floor(w × 0.33) |
≈67% | fortuned,参数 33 × 1 = 33 |
| 2 | LV2(2) |
w - floor(w × 0.66) |
≈34% | fortuned,参数 33 × 2 = 66 |
| 3 | LV3(3) |
直接返回 0 | 0% | fortuned,参数特判为 100 |
tooltip 文本 enhancedlootbags.string.fortuned = §6Contains %d%% fewer low-tier drops.(§6Contains %d%% fewer low-tier drops.)
计算取整方式:Math.floor(w * (0.33D * level)),即每级削减 33%,逐级向下取整。
LV3 的特殊短路(与 F1/F2 完全不同)
时运 III 不是"垃圾权重为 0"这么简单,它触发了一条独立的代码路径。在 getMergedGroupFromID:
if (!tTargetGroup.getCombineWithTrash() || (EnhancedLootBags.ELBCfg.AllowFortuneBags && pFortuneLevel == 3))
tReturnGroup = tTargetGroup; // 完全不合并垃圾组
else
// 合并垃圾组,按 level 削减每条垃圾权重
| 等级 | 垃圾组是否合并进抽取池 | 垃圾条目权重 | 机制 |
|---|---|---|---|
| LV0 / LV1 / LV2 | ✅ 合并 | 100% / ≈67% / ≈34% | 权重削减(走 copyDrop(drop, level) + recalcWeightByFortune) |
| LV3 | ❌ 完全不合并 | 不适用 | 短路返回(连合并缓存都不进) |
两条路径的实质差异:
- LV1/LV2:垃圾条目还在表里,只是权重被压低;摇到垃圾仍可能掉垃圾,只是概率小得多
- LV3:垃圾根本不在抽取表里,100% 掉本组战利品
因此 LV3 才是真正的"无垃圾袋",而 F1/F2 只是"低垃圾袋"。tooltip 里 LV3 显示 “Contains 100% fewer low-tier drops” 正是这个意思。
对物品抽取与其它系统的影响
| 影响面 | 行为 |
|---|---|
| 组本身战利品 | 权重不变——时运只削减垃圾组,不提升本组物品的权重 |
| 实际中奖率 | 因分母(垃圾权重)变小而上升,预览界面以 Drop % (F0/1/2/3) 四值形式展示 |
| 合并缓存 | LV0/LV1/LV2 各缓存一份(键 "组ID-时运等级");LV3 不进缓存 |
| 创造模式标签页 | getSubItems 为每个 CombineTrashGroup=true 的组额外生成一个已附时运 III 的袋子实例 |
| Nei 集成 | loadUsageRecipes 读取手持/查询袋子的时运等级并生成对应配方页;drawExtras 在时运 ≠ 3 时额外画出 “Also has loot from: <垃圾组名>” 一行 |
组 CombineTrashGroup=false |
时运完全无效果(不合并即无垃圾可削减),tooltip 改为 no_fortune_needed = “You’re feeling lucky!” |
AllowFortuneBags=false |
时运完全无效果 |
Dreamcraft 提示
ItemLootBag 中 isDreamcraftLoaded = Loader.isModLoaded("dreamcraft") 为真时,时运等级为 0 的袋子会额外追加一行提示:
enhancedlootbags.dreamcraft.enchantment_tip = §3Craft with a Fortune III book and a component to improve!
(§3Craft with a Fortune III book and a component to improve!)
相关条目
- 战利品袋(LootBag) - 附魔值、tooltip 判定逻辑
- 垃圾组合并机制 - 时运削减垃圾权重的完整路径
- 掉落条目规则 - 权重分母与实际中奖率算法
- AllowFortuneBags 配置项 - 时运系统的总开关
- 战利品组等级体系 -
Rarity与时运是两套独立分档