preferences 包

基本信息

属性 值
位置 src/main/java/sedridor/amidst/preferences/
类数 8
启用版本 Minecraft 1.7.10

AMIDST 的配置持久化框架。与 Forge 的 Configuration / .cfg 无关, 是自研的 PrefModel 体系。

8 个类

类 作用
PrefModel 偏好项基类
BooleanPrefModel 布尔开关(图层显隐等,11 个开关的主要形态)
StringPreference 字符串偏好
SelectPrefModel 下拉选择偏好
FilePrefModel 文件路径偏好
FilePreferences 偏好集合,根容器
FilePreferencesGenerator 偏好文件生成器
BiomeColorProfile 生物群系配色方案

与 Options 的关系

Options 是单成员枚举, 持有 57 处 PrefModel 引用(约 56 个配置项)。 它是内存中的当前值容器,而本包负责落盘。

即数据流是:

Options.instance.<field>  ──(PrefModel)──>  FilePreferences  ──>  磁盘文件

⚠️ FilePreferences 使用的文件格式与位置需看 FilePreferencesGenerator, 但可以确定不是 config/forgeamidst 下的 Forge cfg (那是被 MapWorldSaveHandler 用的存档目录)。

唯一带 Forge 侧资源引用的类

BiomeColorProfile 与 ForgeAmidst 的资源域 assets/forgeamidst/biome(30 个 png)对应 —— 即群系配色图由 Forge 资源系统提供,而非 AMIDST 自带。

PrefModel 家族(4 个具体实现)

抽象/具体 用途
PrefModel 基类
BooleanPrefModel 布尔(图层开关、mapFlicking 等)
SelectPrefModel 枚举选择
FilePrefModel 文件路径
(StringPreference) 字符串

⚠️ StringPreference 命名与其它 3 个不一致 —— 其它是 XxxPrefModel,它是 XxxPreference。 这是 sedridor.amidst 包内的一处命名不统一(反编译来源不同作者的痕迹)。

⚠️ BiomeColorProfile 与 FilePreferencesGenerator 不以 PrefModel 结尾, 但同在本包 —— 按命名模式筛类会漏掉它们。

关联