配置
基本信息
| 属性 | 值 |
|---|---|
| 位置 | src/main/java/com/slprime/chromatictooltips/config/ |
| 配置类 | 3 |
| 配置项 | 约 74(按 @Config.* 注解行计) |
| 启用版本 | Minecraft 1.7.10 |
3 个配置类(用 Forge 原生 @Config)
@Config(modid = ChromaticTooltips.MODID, category = "general")
@Config.Order(0)
public class GeneralConfig { … }
| 类 | category |
@Config.Order |
@Config.* 注解行数 |
|---|---|---|---|
GeneralConfig |
general |
0 |
23 |
EnricherConfig |
enricher |
— | 39 |
StackAmountConfig |
stackamount |
— | 12 |
⚠️ 三个类都用 Forge 原生 @Config,与 UniMixins
那套自研 annotatedproperties 体系完全不同。两个仓的配置机制不可混谈。
⚠️ GeneralConfig 是唯一带 @Config.Order(0) 的类 ——
用于固定它在配置 GUI 中的排序位置。
⚠️ category = "stackamount" 没有下划线(不是 stack_amount),
而 modid 是 chromatictooltips(全小写无分隔)。
配置节名与 modid 的命名风格不统一。
⚠️ 上表「注解行数」是 grep -cE '@Config\.' 的结果,
包含 @Config.Comment / @Config.Default 等每个属性上的多个注解,
不等于属性个数。实际属性数需按字段声明统计,会少于此数。
引用时不要把它当「配置项数量」。
关键配置:资源包主题
GeneralConfig 首个配置项的注释:
Enable resource pack themes. This allows resource packs to define custom tooltip themes. Disabling this will prevent the game from loading any tooltip themes defined in resource packs.
⚠️ 这是资源包主题开关,与 ClientProxy 实现
IResourceManagerReloadListener(资源包重载回调)配套。
⚠️ 主题由 util/ThemeManager 加载,
资源位于 assets/chromatictooltips/tooltip.default.json 与
tooltip.template.json(见下)。
资源文件
| 文件 | 用途 |
|---|---|
assets/chromatictooltips/tooltip.default.json |
默认主题 |
assets/chromatictooltips/tooltip.template.json |
资源包作者参考的模板 |
⚠️ 两者是 JSON(不是 Forge cfg 的 .cfg)——
主题定义走 JSON,Forge 配置项走 .cfg,两套并存。
关联
- ClientProxy -
implements IResourceManagerReloadListener - TooltipRenderer - 消费主题
- util 包 -
ThemeManager等 15 个工具类 - UniMixins - 另一仓用自研配置框架(对比)