Registry
基本信息
com.github.dcysteine.neicustomdiagram.main.Registry —— 图表生成器的唯一注册真源,
以枚举单例(INSTANCE)实现,static 块里集中列出全部生成器。
组 ID 拼接规则
public static final String GROUP_ID_PREFIX = "neicustomdiagram.diagramgroup.";
每个 RegistryEntry.create("<suffix>", ...) 的实际 groupId 为
GROUP_ID_PREFIX + suffix。共 15 条注册记录。
已注册的全部 15 组
| # | 后缀 | 生成器类 | 硬依赖 |
|---|---|---|---|
| 1 | debug.nbtviewer |
NbtViewer |
— |
| 2 | debug.ruler |
DebugRuler |
— |
| 3 | enderstorage.chestoverview |
EnderStorageChestOverview |
Mods.ENDER_STORAGE |
| 4 | enderstorage.tankoverview |
EnderStorageTankOverview |
Mods.ENDER_STORAGE |
| 5 | forge.fluidcontainers |
ForgeFluidContainers |
— |
| 6 | forge.oredictionary |
ForgeOreDictionary |
— |
| 7 | forge.worldgenloot |
ForgeWorldgenLoot |
— |
| 8 | gregtech.circuits |
GregTechCircuits |
Mods.GREGTECH_5 |
| 9 | gregtech.lenses |
GregTechLenses |
Mods.GREGTECH_5 |
| 10 | gregtech.materialparts |
GregTechMaterialParts |
Mods.GREGTECH_5 |
| 11 | gregtech.materialtools |
GregTechMaterialTools |
Mods.GREGTECH_5 |
| 12 | gregtech.oredictionary |
GregTechOreDictionary |
Mods.GREGTECH_5 |
| 13 | gregtech.oreprefixes |
GregTechOrePrefixes |
Mods.GREGTECH_5 |
| 14 | gregtech.oreprocessing |
GregTechOreProcessing |
Mods.GREGTECH_5 |
| 15 | gregtech.recipedebugger |
GregTechRecipeDebugger |
Mods.GREGTECH_5 |
用
grep -c 'RegistryEntry.create('计数会得到 15,但源码里RegistryEntry.create一行内出现两次(缩进换行),必须按entriesBuilder.add(的调用点计数。
三道过滤闸门
initialize() 依次过滤:
- 缺依赖 ——
entry.missingDependencies()非空则continue并打 warn。 - 硬禁用 —— 组 ID 命中配置项
hard_disabled_diagram_groups则continue并打 warn。 - 软禁用 —— 在
generateDiagramGroups()里,ConfigOptions.getDiagramGroupVisibility(info) == DISABLED则continue(此时生成器已构造完,只是不出图)。
闸门 1/2 在初始化期,闸门 3 在生成期。三者效果不同:前两者完全不构造对象。
内存管理
cleanUp() 把 generators 置 null。源码注释指出生成器在生成完毕后不再使用、
内存占用可观,置空以便 GC —— NeiCustomDiagram.onLoadComplete() 在生成后立即调用。
注册到 NEI
generateDiagramGroups() 对每个存活生成器调用:
API.registerRecipeHandler(diagramGroup);
API.registerUsageHandler(diagramGroup);
处理器元信息由 NeiIntegration 在 NEIRegisterHandlerInfosEvent 中注册。
相关条目
源码
src/main/java/com/github/dcysteine/neicustomdiagram/main/Registry.javasrc/main/java/com/github/dcysteine/neicustomdiagram/main/NeiIntegration.java