依赖门控 Dependency Gate

本 mod 是纯兼容层,几乎每一段注册逻辑都挂在一个"某个 mod 是否加载"的判断上。 本条目把全部 7 个门控点集中列出,这是判断"某个功能为什么没出现"的唯一入口。

硬性版本门控(不可配置)

位置 条件 不满足时
@Mod 注解 required-after:TConstruct@[1.7.10-1.8.6b.build977,) FML 拒绝加载
@Mod 注解 required-after:gregtech@[MC1710] FML 拒绝加载
@Mod 注解 before:TiCTooltips@[1.2.4,) FML 拒绝加载
TGregworks 构造函数 if (GregTech_API.VERSION < 509) throw new RuntimeException(...) 直接崩溃,提示"GregTech 版本过旧,请改用 TGregworks 主线版或切到 GT5U"

构造函数里还有一条纯日志的探测:if (Loader.isModLoaded(Mods.TConstruct)) log.info("TConstruct detected, initializing Intergalactical integration...")。 Mods 常量表只有 4 个 modid:TGregworks / TGregworks_NAME="Tinkers' Gregworks"、 gregtech / TConstruct / TiCTooltips / IguanaTweaksTConstruct (TinkersTailor 已在源码里被注释掉,IntegrationTinkersTailor 的调用点也被注释掉)。

逐点门控

门控点 条件 影响的注册 关闭时的行为
CastLegacy.preInit() !TConstruct.pulsar.isPulseLoaded("Tinkers' Smeltery") 部件铸件(23 subtype)+ 23 个物品目录条目 复用 TiC 的 TinkerSmeltery.metalPattern
addCastExtruderRecipes 默认值 CastLegacy.metalPattern != null enable.recipe.extruder.castExtruderRecipes 的默认值本身 装了 Smeltery 则默认关(铸件已有 TiC 版本),无 Smeltery 则默认开
CastLegacy.remap() TinkerSmeltery.metalPattern != null FMLMissingMappingsEvent 的 TGregworks:metalPattern 重映射 直接 return,不处理
registry.registerFluids() 无门控(init 阶段无条件调用) 全部 TGregFluidType —
IntegrationITT.init() Loader.isModLoaded("IguanaTweaksTConstruct") 且 IguanaTweaksTConstruct.pulsar.isPulseLoaded("ToolPartReplacing") 部件替换修饰符 不注册
IntegrationITT.postInit() pulsar.isPulseLoaded("Tweaks") 且 iguanatweakstconstruct Config.maxToolRepairs > -1 限额修复修饰符 退回普通 修复修饰符
ticTooltips.postInit() Loader.isModLoaded("TiCTooltips") TiCTooltips 部件归类 工具提示按 TiC 默认分类
registerBoltRecipes() 开头 TConstruct.pulsar.isPulseLoaded("Tinkers' Weaponry") 全部 弩箭配方(含工作台版) 直接 return
registerBoltRecipes() 中段 TConstruct.pulsar.isPulseLoaded("Tinkers' Smeltery") 弩箭的流固机路径 直接 return(工作台版已注册)
PHConstruct.alternativeBoltRecipe TiC 自身的配置 TGregAlternateBoltRecipe(无序合成弩箭) 不注册
addRecipesForToolBuilder() 末段 pulsar.isPulseLoaded("Tinkers' Weaponry") 短弓/长弓/弩/箭/回旋镖/飞刀/标枪共 7 条武器配方 18 条基础工具照常注册
registry.registerModifiers() 函数体是空的(ModifyBuilder.registerModifier(new ModifierTGregRepair()) 被注释) — 真正的修饰符注册在 postInit

三个修饰符的注册优先级

TGregworks.postInit 的分支决定了同一时刻只会注册一个修复类修饰符:

  • 有 IguanaTweaksTConstruct 且 maxToolRepairs > -1 → ModLimitedTGregRepair
  • 有 IguanaTweaksTConstruct 但 maxToolRepairs == -1 → ModTGregRepair(else 分支)
  • 无 IguanaTweaksTConstruct → ModTGregRepair(外层 else 分支)

ModTGregPartReplacement 是独立于上述分支的第二个修饰符,在 init 阶段注册。

生命周期

阶段 做什么
构造函数 版本门控(GregTech_API.VERSION < 509 抛异常)
preInit 载入 Configuration → TGregRegistry(读 2 个 general 选项 + 扫描 Materials 分配材料 ID)→ registerItems(28 部件)→ registerToolParts(注册材料)→ TGregRecipeRegistry / TGregRepairRegistry → 6 条 setCategoryComment → 注册 碎片铸件 → CastLegacy.preInit() → 往创造栏塞黑铱大剑刃样例
init proxy.addToolRenderMappings()(客户端渲染映射)、registry.registerFluids()、proxy.registerRenderers()、IntegrationITT.init()
postInit addRecipesForToolBuilder → addGregTechPartRecipes → registerCastRecipes → registerRepairMaterials → registerBoltRecipes → TiCTooltips → 修复修饰符 → config.save()
remap(FMLMissingMappingsEvent) CastLegacy.remap

config.load() 在 preInit 开头显式调用,config.save() 在 postInit 结尾; getLatestAvailableNumber() 自动生成的材料 ID 就是在 postInit 收尾时落盘到 materials.material-id.* 的。

相关条目