DiagramGroupVisibility

基本信息

com.github.dcysteine.neicustomdiagram.main.config.DiagramGroupVisibility —— 控制图表组在 NEI 中何时可见的枚举。每个值实现 isShown()。

全部 7 个取值

取值 isShown() 返回 语义
ALWAYS_SHOWN true 始终显示(DiagramGroupInfo 默认值)
ALWAYS_HIDDEN false 始终隐藏
SHOW_ON_SHIFT NEIClientUtils.shiftKey() 按住 <Shift> 才显示
HIDE_ON_SHIFT !NEIClientUtils.shiftKey() 按住 <Shift> 反而隐藏
SHOW_ON_CTRL NEIClientUtils.controlKey() 按住 <Ctrl> 才显示
HIDE_ON_CTRL !NEIClientUtils.controlKey() 按住 <Ctrl> 反而隐藏
DISABLED false 跳过初始化(见下)

DISABLED 的特殊性

源码注释明确:

This is a special value which will not only hide the diagram group, but also skip initialization of the diagram group. […] Changing to it will hide the diagram group, but the group will remain in memory until Minecraft is restarted.

即 DISABLED 在 Registry 里通过 HARD_DISABLED_DIAGRAM_GROUPS 闸门 (初始化期)而非可见性闸门(生成期)生效,效果是根本不构造生成器。

⚠️ 语义易写反:HIDE_ON_SHIFT 是「按 Shift 时隐藏」, 目的是让用户按住 Shift 跳去别的 NEI 标签页;不是「松开才隐藏」。

15 组的默认可见性分布

用「15 个生成器里 setDefaultVisibility(...) 的调用点」清点,只有 8 个生成器显式调用:

可见性 组数 组
DISABLED 7 nbt-viewer、debug-ruler、forge-fluid-containers、forge-ore-dictionary、gregtech-ore-dictionary、gregtech-ore-prefixes、gregtech-recipe-debugger
ALWAYS_SHOWN(显式,与默认值相同) 1 world-gen-loot
未设置 → 取默认值 ALWAYS_SHOWN 7 ender-storage-chest-overview、ender-storage-tank-overview、gregtech-circuits、gregtech-lenses、gregtech-material-parts、gregtech-material-tools、gregtech-ore-processing

合计 7 + 1 + 7 = 15。即:8 组始终可见,7 组默认 DISABLED。

SHOW_ON_SHIFT / HIDE_ON_SHIFT / SHOW_ON_CTRL / HIDE_ON_CTRL / ALWAYS_HIDDEN 这 5 个取值在当前 15 个生成器中一个都没被使用。

安全解析

getByName(String) 捕获 IllegalArgumentException 后打 error 并回退到 ALWAYS_SHOWN (而非抛出),因此配置文件里写错的组名不会导致崩溃。

相关条目

源码

  • src/main/java/com/github/dcysteine/neicustomdiagram/main/config/DiagramGroupVisibility.java