ComputerCraft 外设与 OpenComputers 驱动
基本信息
| 属性 | 值 |
|---|---|
| CC 外设类型 | 17(14 个 Thaumcraft + 3 个本模组) |
| OC 驱动 | 6 |
| CC 初始化点 | TTCommonProxy.initCCPeripherals(),TTCommonProxy.java:238-249 |
| OC 初始化点 | TTCommonProxy.initOpenCDrivers(),TTCommonProxy.java:251-259 |
| CC 触发条件 | LoadedMods.computerCraftLoaded,TTCommonProxy.java:135 |
| OC 触发条件 | LoadedMods.openComputersLoaded,TTCommonProxy.java:163 |
| 相关研究 | KEY_PERIPHERALS = PERIPHERALS(由 ResearchHelper 直注册) |
两条集成路径互相独立:CC 走 preInit(),OC 走 init()。CC 缺失不影响 OC,反之亦然。
数值:CC 外设(17)
initCCPeripherals() 构造一个 Class[] 数组并交给 PeripheralHandler(TTCommonProxy.java:241-243),随后调用 handler.registerPeripheralProvider()(:247)与 ComputerCraftAPI.registerTurtleUpgrade(new FumeTool())(:248)。
| # | 类型 | 来源 | 所属模组 |
|---|---|---|---|
| 1 | TileAlembic |
thaumcraft.common.tiles |
Thaumcraft |
| 2 | TileCentrifuge |
thaumcraft.common.tiles |
Thaumcraft |
| 3 | TileCrucible |
thaumcraft.common.tiles |
Thaumcraft |
| 4 | TileInfusionMatrix |
thaumcraft.common.tiles |
Thaumcraft |
| 5 | TileJarFillable |
thaumcraft.common.tiles |
Thaumcraft |
| 6 | TileJarNode |
thaumcraft.common.tiles |
Thaumcraft |
| 7 | TileNode |
thaumcraft.common.tiles |
Thaumcraft |
| 8 | TileTubeFilter |
thaumcraft.common.tiles |
Thaumcraft |
| 9 | TileWandPedestal |
thaumcraft.common.tiles |
Thaumcraft |
| 10 | TileDeconstructionTable |
thaumcraft.common.tiles |
Thaumcraft |
| 11 | TileJarBrain |
thaumcraft.common.tiles |
Thaumcraft |
| 12 | TileSensor |
thaumcraft.common.tiles |
Thaumcraft |
| 13 | TileArcaneBore |
thaumcraft.common.tiles |
Thaumcraft |
| 14 | IEssentiaTransport |
thaumcraft.api.aspects(接口) |
Thaumcraft |
| 15 | TileFunnel |
thaumic.tinkerer.common.block.tile |
本模组 |
| 16 | TileRepairer |
thaumic.tinkerer.common.block.tile |
本模组 |
| 17 | TileTransvectorInterface |
…common.block.tile.transvector |
本模组 |
第 14 项是接口而非类,但同处 Class[] 数组中。
数值:CC 外设类文件
common/peripheral/ 目录下有 6 个 Peripheral* 外设类 + 1 个 PeripheralHandler 提供者 + 1 个 implementation/ 子包:
| 类 | 说明 |
|---|---|
PeripheralHandler |
final class … implements IPeripheralProvider(PeripheralHandler.java:30),持有 public static List<String> Blacklist(:32),在匹配时逐项跳过(:35) |
PeripheralArcaneBore |
arcane bore 外设 |
PeripheralArcaneEar |
arcane ear 外设 |
PeripheralAspectContainer |
aspect 容器外设 |
PeripheralBrainInAJar |
罐中脑外设 |
PeripheralDeconstructor |
解构外设 |
PeripheralEssentiaTransport |
essentia 传输外设 |
PeripheralTransvectorInterface |
位移接口外设 |
implementation/ArcaneEarImplementation |
辅助实现 |
implementation/IAspectContainerImplementation |
辅助实现 |
外设黑名单
PeripheralHandler.Blacklist 是 public static List<String>(PeripheralHandler.java:32),可由 IMC 消息 AddCCBlacklist 追加:ThaumicTinkerer.HandleIMCMessages() 收到该键后调用 blackListCCDevices(value),后者在 LoadedMods.computerCraftLoaded 为真时执行 PeripheralHandler.Blacklist.add(classname)(ThaumicTinkerer.java:105-108)。详见 API:IMC。
数值:OC 驱动(6)
initOpenCDrivers() 逐个 Driver.add(...)(TTCommonProxy.java:253-258),方法本身带 @Optional.Method(modid = "OpenComputers") 注解:
| # | 驱动类 |
|---|---|
| 1 | DriverIAspectContainer |
| 2 | DriverArcaneEar |
| 3 | DriverBrainInAJar |
| 4 | DriverDeconstructor |
| 5 | DriverEssentiaTransport |
| 6 | DriverArcaneBore |
peripheral/OpenComputers/ 目录另有 ManagedTileEntityEnvironment.java,是 TileEntity 环境的辅助类而非驱动,不计入 6 个。
死代码:OCCompat 与 FumePeripheral
两个 compat/ 下的类虽存在但不参与任何注册:
OCCompat全文只有一个空方法public static void InitOC() {}(compat/OCCompat.java:8),InitOC无调用点。OpenComputers 的实际注册走initOpenCDrivers(),与此空壳类无关。FumePeripheral实现了IPeripheral(getType()返回"gasRemover"),但未出现在initCCPeripherals()的 17 个类型数组中。
证据与计数见 软依赖与兼容层。