ModConfig
GuideNH 的配置分两份:一份是 Forge @Config(.cfg 文件),
一份是 in-game GUI 配置(GuideNHGuiConfig)。
| 项目 | 值 |
|---|---|
| 文件 | config/guidenh/guidenh.cfg |
| 注解 | @Config(modid = GuideNH.MODID, filename = "guidenh", configSubDirectory = "guidenh") |
| 语言键模式 | @Config.LangKeyPattern(pattern = "guideme.gui.config.%cat.%field", fullyQualified = true) |
| 注册类 | com.hfstudio.guidenh.config.ModConfig |
| GUI 工厂 | com.hfstudio.guidenh.config.GuideNHGuiFactory |
| GUI 入口 | @Mod(guiFactory = "com.hfstudio.guidenh.config.GuideNHGuiFactory") |
⚠️ 配置的语言键前缀是 guideme.(沿用 GuideME),不是 guidenh.——
但 @Mod 里 modid 是 guidenh,文件名也是 guidenh.cfg。
这是移植遗留,翻译键查找时不要按 guidenh.gui.config.* 去找。
配置段
ModConfig 有 4 个静态内部类作为分段,共 78 个字段:
| 段 | 字段数 | 用途 |
|---|---|---|
Debug |
22 | 调试日志与 GUI 调试叠加层 |
Ui |
45 | 界面外观(跨会话保留) |
Runtime |
2 | 运行时行为 |
RuntimeBridge |
9 | 运行时桥接 |
统计依据是对 4 个 public static class <段> { ... } 块做字段正则计数;
@Comment 在整个文件里出现 83 次(部分字段有多行注释)。
Debug 段(22 项)
入口开关 2 项:
| 字段 | 默认 | 说明 |
|---|---|---|
enableDebugMode |
false |
打印调试日志。标注 @RequiresMcRestart |
guiDebugMode |
false |
GUI 调试叠加层。在指南界面里按 C+Ctrl+Shift+Alt 激活 |
叠加层显示项 14 项(全部 @DefaultBoolean,除注明外):
| 字段 | 默认 |
|---|---|
showHoveredInfo |
true |
showHoveredPosition |
true |
showHoveredSize |
true |
showHoveredTheme |
true |
showHoveredExtra |
true |
showHoveredOutline |
true |
showParentInfo |
false |
showParentPosition |
true |
showParentSize |
true |
showParentTheme |
true |
showParentOutline |
true |
showFps |
true |
showMemory |
true |
showMousePosition |
true |
只有 showParentInfo 默认关闭。
叠加层外观 6 项,全是 @DefaultFloat + @RangeFloat:
| 字段 | 默认 | 范围 |
|---|---|---|
debugTextScale |
0.8f |
0.5 – 2.0 |
debugOutlineThickness |
2.0f |
0.5 – 5.0 |
debugDashAnimationCycleMs |
2000.0f |
500 – 10000 |
debugDashWidth |
2.0f |
0.5 – 5.0 |
debugDashOnLength |
4.0f |
1.0 – 20.0 |
debugDashOffLength |
4.0f |
1.0 – 20.0 |
2 + 14 + 6 = 22,与段内字段数一致。
debugDashOnLength / debugDashOffLength / debugDashWidth / debugDashAnimationCycleMs
四个控制虚线边框动画:周期 2000 ms,实线 4 px,空隙 4 px,线宽 2 px。
Ui 段(45 项)
界面外观,段注释写明 persisted across sessions。
含 fullWidth(全宽无侧边距,默认 false)、阅读模式、主题、字号、动画等。
另有工具方法 clampPositiveHomeLimit(int value, int fallback)
用于「首页条目上限」的取值夹取。
Runtime / RuntimeBridge 段
| 段 | 字段数 | 关联 |
|---|---|---|
Runtime |
2 | 运行时行为 |
RuntimeBridge |
9 | 桥接设置,对应 网络协议 的 bridge/ 包 |
持久化
ModConfig.save() 显式落盘。registerConfig() 抛 ConfigException,
由 @Mod 生命周期调用。
其它配置文件
| 文件 | 用途 |
|---|---|
config/guidenh/guidenh.cfg |
本条目 |
META-INF/guidenh_at.cfg |
access transformer(在 jar 资源里,不在 config 目录)。由 gradle.properties 的 accessTransformersFile 指定 |