配方处理器

基本信息

属性 值
实现文件 src/main/java/com/github/vfyjxf/nee/processor/
处理器总数 19 个(1 个基类 + 1 个接口 + 17 个条件加载)
注册入口 RecipeProcessor.init()(processor/RecipeProcessor.java:18-107)
触发时机 NEI 加载配置时(NEINeeConfig.loadConfig → RecipeProcessor.init())
产物 NEI 叠加层里的「Request」按钮,把 NEI 配方转成 AE2 ME 样板

处理器是本 mod 的核心:每个 IRecipeProcessor 子类负责从某个模组的配方注册表里取出配方 → 转成 AE2 的 ICraftingPatternDetails → 通过网络包送到 样板接口 或直接塞进终端。

处理器清单(按 RecipeProcessor.init() 加载顺序)

# 处理器类 加载条件
1 VanillaRecipeProcessor 无条件
2 AppengRecipeProcessor appliedenergistics2
3 BotaniaRecipeProcessor Botania
4 GregTech5RecipeProcessor gregtech 且非 gregapi
5 GregTech6RecipeProcessor gregapi 且 gregapi_post
6 ICRecipeProcessor IC2
7 AvaritiaRecipeProcessor Avaritia
8 EnderIORecipeProcessor EnderIO
9 ForestryRecipeProcessor Forestry
10 AspectRecipeIndexRecipeProcessor aspectrecipeindex
11 TCNEIPluginRecipeProcessor thaumcraftneiplugin
12 ThermalExpansionRecipeProcessor ThermalExpansion
13 ImmersiveEngineeringRecipeProcessor ImmersiveEngineering
14 MekanismRecipeProcessor Mekanism
15 BloodMagicRecipeProcessor AWWayofTime
16 BuildCraftRecipeProcessor BuildCraft|Compat
17 GTPPRecipeProcessor miscutils(GT++)
18 GoodGeneratorRecipeProcessor GoodGenerator 且非 NH 版 GT
19 BetterQuestingRecipeProcessor betterquesting 且 bq_standard

只有 VanillaRecipeProcessor 无条件加载(RecipeProcessor.java:21),其余全部按 Loader.isModLoaded 条件注册,缺模组只是少一个处理器。

GregTech 版本探测

RecipeProcessor.java:33-43 用「能否 Class.forName("gregtech.api.recipe.RecipeMap")」区分 GT5 NH 与原版 GT5:

  • 能加载 → isNH = true,日志打「Found NH version of GregTech5」
  • 不能加载 → isNH = false,日志打「Found GregTech5」

这个 isNH 布尔量随后传给 GTPPRecipeProcessor(isNH)(:94),因此 Good Generator 在 NH 版 GT 下被跳过(:96 的 !isNH &&)——NH 自带了同类配方。

标识符集合

NEINeeConfig.loadConfig(NEINeeConfig.java:56-66)把所有处理器的 getAllOverlayIdentifier() 汇总成一个 Set<String>,再为每个标识符向 GuiPatternTerm 注册叠加层。基础集合固定含 6 个原版标识符(:57):

crafting, crafting2x2, brewing, smelting, fuel, null

installPatternTerminalExSupport 会从中移除 crafting 与 crafting2x2(:213-214),因为这两个由 NEECraftingTerminalHandler 单独处理。

黑名单与优先列表

三个字符串列表(config/NEEConfig.java:23-25)控制转换行为,元素格式为 JSON:

{"modid":"minecraft","name":"iron_ingot","recipeProcessor":"EnderIO","identifier":"EnderIOAlloySmelter"}
列表 配置键 作用
黑名单 transfer.transformItemBlacklist 命中则不转换
物品优先 transfer.transformItemPriorityList 命中则优先转换
模组优先 transfer.transformPriorityModList OreDict 中该 mod 的物品优先使用

可用 /nee 的 add 子命令在游戏内追加,格式见该条目。

物品合并模式

itemCombinationMode(config/NEEConfig.java:26)取 3 个值之一(NEEConfig.java:77-81):

值 界面文案键 中文
ENABLED gui.neenergistics.button.name.enabled 开启
DISABLED gui.neenergistics.button.name.disabled 关闭
WHITELIST gui.neenergistics.button.name.whitelist 白名单

WHITELIST 模式只看 transfer.itemCombinationWhitelist 里的标识符。

相关处理器标识符

每个处理器实现 getRecipeProcessorId()(字符串,用于黑名单 JSON 的 recipeProcessor 字段)与 getAllOverlayIdentifier()(该处理器能吃下的 NEI 标识符)。用 /nee processor 可把当前实例的完整对照表打到日志(NEECommands.java:44-50)——这些标识符不是硬编码的静态清单,取决于同时装了哪些模组。