TileEntityIngotCompressor / TileEntityElectricIngotCompressor
事实基准:
/Users/evlos/a/mirror/Galacticraft(master,minecraftVersion = 1.7.10)逐行读源码。
注册信息(两个类,注册名不同)
| TileEntity 注册名 | 注册类 | 源码 | 供电 |
|---|---|---|---|
Ingot Compressor |
micdoodle8.mods.galacticraft.core.tile.TileEntityIngotCompressor |
GalacticraftCore.java:733 |
手动(无 IEnergyHandler) |
Electric Ingot Compressor |
micdoodle8.mods.galacticraft.core.tile.TileEntityElectricIngotCompressor |
GalacticraftCore.java:734 |
电力驱动 |
两者均无条件注册。
槽位数量与布局
两者的 getSizeInventory() 都是
containingItems.length + compressingCraftMatrix.getSizeInventory():
| TileEntity | containingItems 声明 |
合成矩阵 | 合计 |
|---|---|---|---|
TileEntityIngotCompressor |
new ItemStack[2](core/tile/TileEntityIngotCompressor.java:45) |
PersistantInventoryCrafting compressingCraftMatrix(:46) |
2 + 矩阵槽数 |
TileEntityElectricIngotCompressor |
new ItemStack[3](core/tile/TileEntityElectricIngotCompressor.java:42) |
同类字段 | 3 + 矩阵槽数 |
| TileEntity | getSizeInventory() |
行 |
|---|---|---|
TileEntityIngotCompressor |
this.containingItems.length + this.compressingCraftMatrix.getSizeInventory() |
:281-283 |
TileEntityElectricIngotCompressor |
同构 | :183 同式 |
⚠ PersistantInventoryCrafting 的槽数由其父类构造决定,
本条目不写死该数字——只断言「矩阵槽数 + 2 / 3」。
把总数说成「9 格」或「11 格」都需要另找证据。
⚠ 手动版 2 格、电动版 3 格——差的那一格是电力机器的电池 / 能源载体槽, 不可混为一谈。
处理速率 / 耗时(本篇核心,两版不同)
手动版:TileEntityIngotCompressor
core/tile/TileEntityIngotCompressor.java:31:
public static final int PROCESS_TIME_REQUIRED = 200;
| 常量 | 值 | 换算 |
|---|---|---|
PROCESS_TIME_REQUIRED |
200 | 200 tick = 10 秒 |
电动版:TileEntityElectricIngotCompressor(随电压档位变化)
core/tile/TileEntityElectricIngotCompressor.java:31、:34、:61-62:
public static final int PROCESS_TIME_REQUIRED_BASE = 200; // :31
public int processTimeRequired = PROCESS_TIME_REQUIRED_BASE; // :34
...
this.processTimeRequired = PROCESS_TIME_REQUIRED_BASE * 2
/ (1 + this.poweredByTierGC); // :61-62
| 项 | 值 / 公式 |
|---|---|
| 基准耗时 | PROCESS_TIME_REQUIRED_BASE = 200 |
| 实际耗时 | 200 * 2 / (1 + poweredByTierGC) |
poweredByTierGC 是GC 电力网络的电压档位(tier)。代入:
poweredByTierGC |
计算 | 实际耗时 |
|---|---|---|
| 0 | 200 * 2 / 1 |
400 tick = 20 秒 |
| 1 | 200 * 2 / 2 |
200 tick = 10 秒 |
| 2 | 200 * 2 / 3 |
133 tick ≈ 6.7 秒 |
| 3 | 200 * 2 / 4 |
100 tick = 5 秒 |
| 7 | 200 * 2 / 8 |
50 tick = 2.5 秒 |
⚠ 档位越高压得越快(分母 1 + tier 增长)。
⚠ 注意 :61-62 的赋值在 if (this.hasEnoughEnergyToRun && this.canCompress()) 之内(:58)——
机器不在运行时 processTimeRequired 保持上一次的值,不写死单值。
⚠ 手动版耗时恒为 200 tick,电动版随电压变化—— 把两者合并说成「都是 200 tick」即为遗漏电动版的动态公式。
完成反馈
电动版完成时(:64-68):
this.worldObj.playSoundEffect(..., "random.anvil_land", 0.2F, 0.5F);
this.processTicks = 0;
this.compressItems();
即播放铁砧落地声并清零 processTicks。
GUI / Container
| TileEntity | GUI 类 | Container 类 | GuiHandler.java 分派处 |
|---|---|---|---|
TileEntityIngotCompressor |
core.client.gui.container.GuiIngotCompressor |
core.inventory.ContainerIngotCompressor |
Container :140 |
TileEntityElectricIngotCompressor |
core.client.gui.container.GuiElectricIngotCompressor |
core.inventory.ContainerElectricIngotCompressor |
Container :142 |
⚠ 两版各有独立的 Container 与 Gui 类,不是共用一套。
网络封包
走 GC 的 @NetworkedField 字段同步。无独立的封包 ID。