Options

基本信息

属性 值
类名 sedridor.amidst.Options
文件 src/main/java/sedridor/amidst/Options.java
行数 133
类型 enum(单成员枚举)
启用版本 Minecraft 1.7.10

⚠️ 枚举做单例

public enum Options {
    instance;

⚠️ 单成员枚举实现单例 —— 只有一个枚举常量 instance。 因此「Options 枚举有哪些值」的答案是只有 1 个; Options.values().length == 1。把它当普通配置类枚举会数错。

⚠️ 单例没有私有构造(枚举隐式私有),但字段全是 public, 外部可直接改写 Options.instance.minecraftPath 等。

字段规模(实测精确值)

类别 数量 字段
BooleanPrefModel 24 showSlimeChunks、showGrid、metricGrid、showNetherFortresses、showTemples、showPlayers、showStrongholds、showOceanMonuments、showVillages、showSpawn、hideObjects、mapFlicking、mapFading、showBiomeIDs、sortedBiomeList、showFPS、showDebug、showClimate、showScale、showWorldTypeWidget、maxZoom、colorByClimate、rtgHighResolution、logToFile
SelectPrefModel 2 worldType、mapType
FilePrefModel 1 savesDir
StringPreference 1 selectedColorProfile
裸字段 4 minecraftPath、minecraftJar(String)、seed(long)、seedText(String)

配置项合计 32(24 + 2 + 1 + 1 + 4)。

⚠️ 24 个布尔开关 ≠ 11 个图层。 layers/ 只有 11 个类,但开关里只有约 11 个以 show* 命名对应图层; mapFlicking / mapFading / metricGrid / hideObjects / sortedBiomeList / maxZoom / colorByClimate / rtgHighResolution / logToFile 等 不对应任何图层,而是渲染行为或日志开关。 不要建立开关 ↔ 图层的一一映射。

⚠️ 与图层相关的 rtgHighResolution 与 BiomeProviderRTG 呼应,但 Options 本身不 import RTG 类 —— 它只是一个布尔。

⚠️ logToFile 虽是 BooleanPrefModel,但 Amidst 里按 Options.instance.logToFile.get() != null 判断 —— 即用返回值是否为 null 决定是否加 FileLogger, 而非按 true / false。见 Amidst.java 的 main。

硬编码的默认路径

字段 初值
minecraftPath new File(".").getAbsolutePath() —— 当前工作目录
minecraftJar new File(Util.minecraftDirectory, "versions/1.7.10/1.7.10.jar").getAbsolutePath()

⚠️ 版本路径硬编码 versions/1.7.10/1.7.10.jar —— 本条目只对 1.7.10 有效(与版本闸门一致)。

⚠️ minecraftPath 取 new File(".") 即进程工作目录, 在 Forge 环境下通常是游戏启动目录,未必等于 minecraftPath 配置项的真实含义。

seedText 的全局副作用

Project(String seed) 构造器会写 Options.instance.seedText = seed (见 Project),即创建 Project 会改写全局配置。

版本字符串

Amidst.version() 返回:

条件 返回
MinecraftUtil.hasInterface() 为真 "1.4 [Minecraft " + MinecraftUtil.getVersion() + "]"
否则 "1.4"

⚠️ AMIDST 自身版本是 1.4(Amidst.java 中 version_major = 1、version_minor = 4、versionOffset = ""), 与 ForgeAmidst 的 @Mod version 1.7.10-1.4-beta 是两套版本号,不要混用。

关联