HarvestCraft 集成

HarvestCraftIntegration(mods/harvestcraft/HarvestCraftIntegration.java)为 HarvestCraft 注册 6 个 recipe handler。

加载判定:Utils.isModLoaded("harvestcraft")(HarvestCraftIntegration.java:17)——注意此处 modid 是全小写 harvestcraft。

6 个 Handler

HarvestCraftIntegration.loadConfig()(:21-41)是 6 个集成中唯一按目标 mod 实际 API 分别分支的:

Handler 注册条件 判定方式
RecipeHandlerApiary 无条件 ——
RecipeHandlerPresser PresserRecipes 有 pressing() 方法 try { PresserRecipes.class.getMethod("pressing") }
RecipeHandlerPresserOld PresserRecipes 没有 pressing() 方法 上一条的 catch (NoSuchMethodException) 分支
RecipeHandlerOven com.pam.harvestcraft.OvenRecipes 类存在 Utils.getClass(...) != null
RecipeHandlerChurn com.pam.harvestcraft.ChurnRecipes 类存在 Utils.getClass(...) != null
RecipeHandlerQuern com.pam.harvestcraft.QuernRecipes 类存在 Utils.getClass(...) != null
this.registerHandler(new RecipeHandlerApiary());

try {
    PresserRecipes.class.getMethod("pressing");
    this.registerHandler(new RecipeHandlerPresser());
} catch (NoSuchMethodException e) {
    this.registerHandler(new RecipeHandlerPresserOld());
}

if (Utils.getClass("com.pam.harvestcraft.OvenRecipes") != null) { ... }

mods/harvestcraft/ 下共 7 个 RecipeHandler*.java,其中 RecipeHandlerHCBase.java 是公共基类(未注册)。

因此 6 个是上限而非定数:实际注册数取决于安装的 HarvestCraft 版本,最多 6 个,最少 2 个(Apiary + Presser 之一)。

Presser 的新旧双版本

RecipeHandlerPresser 与 RecipeHandlerPresserOld 是同一台机器的两个世代,通过 PresserRecipes 是否有静态方法 pressing() 来区分——有则用新版,否则用旧版。两者互斥,永远只注册一个。

它们各自有独立的 NEI 配方页图标:

assets/neiintegration/textures/harvestcraft/presser.png
assets/neiintegration/textures/harvestcraft/presserOld.png

RecipeHandlerPresserOld 的存在说明 HarvestCraft 存在老版本 Presser 方块(meta 不同或注册名不同),NEI 侧要分别展示。

唯一自带贴图的集成

HarvestCraft 是 6 个集成中唯一在 src/main/resources/assets/neiintegration/textures/ 下拥有专属子目录的:

textures/harvestcraft/churn.png
textures/harvestcraft/oven.png
textures/harvestcraft/presser.png
textures/harvestcraft/presserOld.png
textures/harvestcraft/quern.png

共 5 张。Apiary 复用通用贴图。

其余集成共用 textures/basicProcessing.png(通用加工进度条)与 textures/overlays.png、textures/blank.png。

编译期依赖

compileOnly('com.github.GTNewHorizons:harvestcraft:1.3.11-GTNH:dev') { transitive = false }

GTNewHorizons 坐标 + compileOnly + transitive = false。

收录情况

⚠️ HarvestCraft 本 wiki 已收录(harvestcraft 分类)。本条目只记录 NEI-Integration 为其注册的 handler、图标与条件,不复述 HarvestCraft 的方块/物品/机器内容。

相关条目