Mod Color Tables
基本信息
compat/colors/ 下 23 个 *Colors 类(ColorRegistrationHelper 之外)——
每个类为一个其他 mod 的方块表登记彩色发光。
它们由 ModCompat 枚举按需触发。
⚠️ 本条目是「为什么覆盖率工具在这类 mod 上必然失真」的实证。
tools/coverage_census.py把字面量registerBlock(计入「注册点」, 在 Supernova 上数出 249 个 —— 但 Supernova 不注册任何方块。 这 249 个全部是ColorRegistrationHelper.registerBlock(modId, name, …), 即给别的 mod 的方块登记颜色。详见文末「与 census 的关系」。
调用形态分布
ColorRegistrationHelper 共 7 个入口,被这 23 个类调用的分布:
| 入口 | 调用次数 |
|---|---|
registerBlock |
246 |
registerPerMeta |
10 |
registerDyed |
6 |
registerDyeRemapped |
3 |
合计 265 次调用,字面量 registerBlock( 计数 249
(246 次调用 + ColorRegistrationHelper.java 自身 3 处声明)。
跨类按内容分工:
| 形态 | 用途 |
|---|---|
registerBlock |
整方块统一色(或单 meta) |
registerPerMeta |
一整个 int[] 每 meta 一色 |
registerDyed |
按染料序(meta 0=白…15=黑)批量 16 个 |
registerDyeRemapped |
染料序但重映射到目标模组的 meta |
逐类调用数
| 类 | registerBlock |
其他 | modid 字符串 |
|---|---|---|---|
NetherliciousColors |
44 | — | netherlicious |
MiscColors |
43 | — | 30 个(见 ModCompat) |
HBMColors |
19 | — | hbm |
WitcheryColors |
16 | — | witchery |
EtFuturumColors |
13 | — | etfuturum |
ThaumicHorizonsColors |
13 | registerPerMeta ×3 |
ThaumicHorizons |
BotaniaColors |
12 | registerDyed ×4 |
Botania |
GalacticraftColors |
10 | — | GalacticraftCore / GalacticraftMars |
OpenComputersColors |
10 | — | OpenComputers |
BiblioCraftColors |
9 | — | BiblioCraft 等 4 个 |
TwilightForestColors |
7 | — | TwilightForest |
ChiselColors |
7 | registerDyeRemapped ×3 |
chisel |
GalaxySpaceColors |
6 | — | GalaxySpace |
HEEColors |
6 | registerPerMeta ×1 |
HardcoreEnderExpansion |
ThaumicBasesColors |
5 | registerPerMeta ×3 |
thaumicbases |
NaturaColors |
4 | registerPerMeta ×1 |
Natura |
ThaumicExplorationColors |
4 | — | ThaumicExploration |
ExtraUtilitiesColors |
2 | registerDyed ×2 |
ExtraUtilities |
CampfireBackportColors |
4 | — | campfirebackport |
ThaumcraftColors |
3 | registerPerMeta ×2 |
Thaumcraft |
GadomancyColors |
3 | — | gadomancy |
RailcraftColors |
3 | — | Railcraft |
BloodArsenalColors |
3 | — | BloodArsenal |
ProjectRedColors |
0 | 循环 | ProjRed|Illumination |
ProjectRedColors一个ColorRegistrationHelper调用都没有: 它直接用GameRegistry.findBlock+LightColorRegistry.register, 在for (variant = 0; variant < 32; …)里注册 32 meta × 2 方块 = 64 条。 这是「按字面量 grep 会同时高估和低估」的实例。
ProjectRed 的 meta 0–31 约定
类注释:ProjectRed Illumination 的 meta 0–15 按羊毛序
(White, Orange, Magenta, …, Black);装了 EndlessIDs 后 bit 4
是 lit/inverted 标志位,所以要注册 meta 0–31。
色值取 LightColors.BRIGHT_DYE_PALETTE[variant & 0xF]。
未命中不报错
ColorRegistrationHelper 的每个入口都先 GameRegistry.findBlock,
返回 null 就直接返回 0,不抛异常。各类再累加 count,
if (count > 0) 时才打一条
Registered {} <mod> light colors 的 INFO。
ModCompat.registerAll() 另有一层 try/catch (Exception),
失败时 Failed to register color compat for {} 并附 mod.name()
(枚举常量名,不是 modid)。
与 census 的关系
| 项 | 数值 |
|---|---|
coverage_census.py 报 Supernova「reg sites」 |
249 |
| 其中 Supernova 自身注册的方块 | 0 |
| 实际内容 | 23 个兼容类的 265 次颜色登记 |
本 mod 不注册方块、物品、实体、TileEntity(registerItem /
registerModEntity / registerTileEntity 计数均为 0)。
所以这 249 是纯粹的误报,方向与「漏算」相反。
相关条目
- ModCompat — 24 个常量 / 57 个 modid 字符串
- ColorRegistrationHelper — 7 个注册入口
- Light Color Registry — 落库处
- Light Colors — 调色板常量
源码
src/main/java/com/mitchej123/supernova/compat/colors/(23 个*Colors.java)- 复算命令:
grep -rhoF 'registerBlock(' --include='*.java' src/main/java | wc -l→ 249