Skip to content

fix(machine): 补全机器配方运行失败的具体原因 - #116

Open
mmyddd wants to merge 6 commits into
devfrom
recipe_failed
Open

mmyddd wants to merge 6 commits into
devfrom
recipe_failed

Conversation

@mmyddd

@mmyddd mmyddd commented Sep 10, 2026

Copy link
Copy Markdown
Member
  • 新增共享失败原因文案:无 EU 输出、输出功率不足、输入不足、输出堵塞、配方类型不支持
  • CTNHRecipeHelper 新增并行失败诊断与输出功率诊断辅助方法,可区分输入材料不足与输出仓堵塞
  • 涡轮发电机区分未找到转子支架、无有效转子、无发电量、输出功率不足,并给出所需与当前 EU/t
  • 等离子涡轮在输出功率不足时提示补充算力以提高输出上限
  • 电弧发生器提示所需与当前电弧强度;光伏无人机站提示挖矿配方仅限轨道维度
  • 烈焰高炉、等离子合金高炉、西诺普化工分别提示炽焱不足、缺少等离子体、线圈温度不足
  • 宽域粒子加速器提示中子/电子/质子速度不足的所需与当前数值
  • 超导彭宁阱提示供电不足,动能多方块提示动力转速不足
  • 屠宰场提示缺少带实体数据的刷怪笼,工厂机器复用既有“缺少所需的生产资料”提示
  • 机器类型不匹配改用 RecipeModifier.nullWrongType 记录开发期错误,不再冒充玩家可见的失败原因
  • 修正化学燃料发电机把机身类型误报为大型内燃机的问题
  • 重新生成 zh_cn/en_us/en_ud 语言文件

- 新增共享失败原因文案:无 EU 输出、输出功率不足、输入不足、输出堵塞、配方类型不支持
- CTNHRecipeHelper 新增并行失败诊断与输出功率诊断辅助方法,可区分输入材料不足与输出仓堵塞
- 涡轮发电机区分未找到转子支架、无有效转子、无发电量、输出功率不足,并给出所需与当前 EU/t
- 等离子涡轮在输出功率不足时提示补充算力以提高输出上限
- 电弧发生器提示所需与当前电弧强度;光伏无人机站提示挖矿配方仅限轨道维度
- 烈焰高炉、等离子合金高炉、西诺普化工分别提示炽焱不足、缺少等离子体、线圈温度不足
- 宽域粒子加速器提示中子/电子/质子速度不足的所需与当前数值
- 超导彭宁阱提示供电不足,动能多方块提示动力转速不足
- 屠宰场提示缺少带实体数据的刷怪笼,工厂机器复用既有“缺少所需的生产资料”提示
- 机器类型不匹配改用 RecipeModifier.nullWrongType 记录开发期错误,不再冒充玩家可见的失败原因
- 修正化学燃料发电机把机身类型误报为大型内燃机的问题
- 重新生成 zh_cn/en_us/en_ud 语言文件
- 修正 RecipeRemoval 中类体起始空行导致的 spotlessJavaCheck 失败
- 该违规自 dev 分支继承而来,本次一并修正以保证 spotlessCheck 通过
- 移除 CTNHRecipeHelper.diagnoseParallelFailure:不再由机器推断是输入不足还是输出堵塞
- 烈焰高炉、纳米摩擦发电机、效率发电机、硅岩反应堆在并行数小于 1 时改为按 1 并行继续
- 由后续配方匹配(RecipeHelper.matchContents)给出真实失败原因,与普通机器口径一致
- 移除随之不再使用的两条文案 recipeModifierInsufficientInput、recipeModifierOutputFull
- 保留 recipeModifierNoEuOutput、recipeModifierInsufficientOutputPower:二者为直接计算结果而非推断
- 重新生成语言文件,仅减少上述两个键

long recipeEUt = recipe.getOutputEUt();
if (recipeEUt <= 0) return RecipeModifier.DEFAULT_FAILURE;
if (recipeEUt <= 0) return CTNHCommonTooltips.recipeModifierNoEuOutput.translate();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要写这个,直接返回null就行,理论上来说发电机不会有耗电的配方,如果有说明出bug了

long maxOutput = generator.getOverclockVoltage();
int maxParallel = (int) (maxOutput / recipeEUt);
if (maxParallel <= 0) return CTNHRecipeHelper.insufficientOutputPower(recipeEUt, maxOutput);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里maxParallel<0直接返回null放行配方(和gtm中的类似做法统一),让后续模拟执行去产生正确的配方失败原因

@@ -152,13 +154,13 @@ public static Component naquadahReactor(MetaMachine machine, RecipeHandlerGroup
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个叫naquadahReactor的modifier有问题,直接删掉,改用EfficiencyGeneratorMachine.recipeModifier

public static Component insufficientOutputPower(long requiredEUt, long maxEUt) {
return CTNHCommonTooltips.recipeModifierInsufficientOutputPower.translate(
FormattingUtil.formatNumbers(requiredEUt), FormattingUtil.formatNumbers(maxEUt));
}

@illuciaz23 illuciaz23 Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

理论上来说不需要这个,超过发电机电压的配方应当被TIER_CHECK拦截。删掉这个,改为给可能涉及的发电机补TIER_CHECK

@EN("Recipe modification failed")
public static Lang gtceuRecipeModifierDefaultFail;

@CN("该配方没有定义 EU 输出")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种情况属于bug,不应当保留

- 效率发电机(硅岩反应堆/火箭引擎)删除 CTNHRecipeModifiers.naquadahReactor,统一改用 EfficiencyGeneratorMachine.recipeModifier
- 发电机不再为无 EU 输出、输出功率不足自造玩家可见文案,改回返回 null,由后续配方模拟给出真实原因
- 删除 CTNHRecipeHelper.insufficientOutputPower 与 CTNHCommonTooltips 的 recipeModifierNoEuOutput / recipeModifierInsufficientOutputPower
- 效率发电机、等离子涡轮补 GTRecipeModifiers.TIER_CHECK;化学燃料发电机与等离子涡轮改由 TIER_CHECK 拦截超压配方
- 发电机改读 recipe.getOutputEUt(),不再用带符号净 EU;移除 CTNHRecipeModifiers 中重复的硅岩反应堆实现
- 重新生成 zh_cn/en_us/en_ud 语言文件,移除上述三个键
- 同步 dev 的 #115 generator EU 读取修正、#117 方块翻译声明、#118 多方块新配方基类迁移
- 解决 ChemicalGeneratorMachine 冲突:EUt 来源沿用 dev 的 recipe.getOutputEUt(),失败分支按 review 意见不再保留自造文案
- 化学燃料发电机与等离子涡轮补并行数为 0 的放行守卫,避免 multiplyAllContents(0) 清零配方内容
if (recipe.recipeType != CTNHRecipeTypes.LARGE_NAQUADAH_REACTOR_RECIPES) return RecipeModifier.DEFAULT_FAILURE;
if (recipe.recipeType != CTNHRecipeTypes.LARGE_NAQUADAH_REACTOR_RECIPES) {
return CTNHCommonTooltips.recipeModifierUnsupportedRecipeType.translate();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也不需要,这种情况是代码bug

- 该机器只注册 LARGE_NAQUADAH_REACTOR_RECIPES 一种配方类型,modifier 不可能收到其他类型,检查为死代码
- 删除 modifyRecipe 中的 recipeType 判断与 recipeModifierUnsupportedRecipeType 文案
- 清理随之失效的 CTNHRecipeTypes / CTNHCommonTooltips 导入与 zh_cn/en_us/en_ud 语言键
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants