Cell Type
基本信息
common/storage/CellType.java —— 流体储存格的 8 档容量枚举,
以 meta 值 0–7 与 AEFeature.StorageCells 绑定。
| 常量 | meta | 聊天颜色 | 面向 |
|---|---|---|---|
Cell1kPart |
0 | GOLD |
多流体(M)版 |
Cell4kPart |
1 | YELLOW |
多流体 |
Cell16kPart |
2 | GREEN |
多流体 |
Cell64kPart |
3 | AQUA |
多流体 |
Cell256kPart |
4 | BLUE |
多流体 |
Cell1024kPart |
5 | LIGHT_PURPLE |
多流体 |
Cell4096kPart |
6 | RED |
多流体 |
Cell16384kPart |
7 | DARK_PURPLE |
多流体 |
枚举名一律
Cell<容量>kPart,小写 k(Cell1kPart不是Cell1KPart); 而注册名是大写 K(CELL1K…CELL16384K)。两边拼写不同。
类型与槽位
| 成员 | 签名 |
|---|---|
VALUES |
public static final CellType[] VALUES = values() |
| 字段 | private EnumSet<AEFeature> features、private int damageValue、private Item itemInstance |
| 构造 | CellType(int metaValue, AEFeature part),features 固定 EnumSet.of(AEFeature.StorageCells) |
每档的 features 都是同一个 AEFeature.StorageCells ——
本枚举不区分多流体与单流体,那由物品侧(ItemAndBlockHolder.CELLxxK
vs CELLxxKM)区分。
取用与绑定
| 方法 | 行为 |
|---|---|
stack(int size) |
造 ItemStack(getItemInstance(), size, getDamageValue()) |
getItemInstance() |
返回 itemInstance |
setItemInstance(Item) |
运行时回填(itemInstance 不由枚举构造器设置) |
getDamageValue() / setDamageValue(int) |
meta 读写 |
itemInstance 初始为 null,必须由外部在初始化阶段 setItemInstance,
否则 stack() 会 NPE。
两种取色重载
getTypeColor 有两个重载:
| 重载 | 索引方式 |
|---|---|
getTypeColor(CellType type) |
switch 直接映射(源码用 switch 表达式,无 default) |
getTypeColor(int type) |
先 VALUES[type % VALUES.length] 再委托上面那个 |
int 重载用取模而非越界检查 —— 负数会抛 ArrayIndexOutOfBoundsException。
switch 无 default 分支,新增枚举常量而不同步这里会漏着色。
与升级卡的关系
这 8 档正是 AE2 升级卡注册 里
CELL1K…CELL16384K 与 CELL1KM…CELL16384KM 的来源:
INVERTER 与 STICKY 各覆盖全部 16 个物品,
VOID_OVERFLOW 覆盖 8 个非 M 版 + QUANTUM_CELL,
DISTRIBUTION 只覆盖 8 个 M 版。
相关条目
源码
src/main/java/com/glodblock/github/common/storage/CellType.java