配置项
基本信息
| 属性 | 值 |
|---|---|
| 处理类 | ConfigHandler(system/ConfigHandler.java,230 行) |
| 配置后端 | Forge net.minecraftforge.common.config.Configuration(没有自研 ConfigField 包装类) |
| 配置节 | 3 个:client / notifications / general |
| 配置项总数 | 19 个 |
| 注册点 | ConfigHandler.register(e.getSuggestedConfigurationFile())(HardcoreEnderExpansion.java:105,在 onFMLPreInitialization) |
| 配置 API 文档 | 配置注释指向 http://hee.chylex.com/config;IMC 注释指向 http://hee-api.chylex.com |
功能
ConfigHandler 用 5 个私有辅助方法直接读 Forge Configuration:getBoolValue(直接取值,:207)、getBool / getInt / getDecimal / getString / getStringArray(返回 Property 以便链式 .setRequiresMcRestart(true) / .setShowInGui(false),:211-229)。当前节由 currentCategory 字段决定(:60),三个加载方法各自设置(:81、:113、:136)。
| 加载方法 | 调用者 | 时机 |
|---|---|---|
loadClient() |
ModClientProxy.java:141 |
客户端 |
loadGeneral() |
ModCommonProxy.java:16 |
双端 |
getGuiConfigElements() |
GuiModConfig.java:16、GuiEnderCompendium.java:174、HeeClientCommand.java:48 |
客户端 GUI |
onConfigChanged(OnConfigChangedEvent) 在 modid 匹配 "HardcoreEnderExpansion" 时转发 HardcoreEnderExpansion.proxy.loadConfiguration()(:72-75)。
首次加载门控
firstTimeClient / firstTimeGeneral 两个 boolean(:61)把部分配置项包在 if (firstTime…) { … } 里,只在首次读取(:88-106、:160-200),之后置 false。这些是需要 setRequiresMcRestart(true) 的项。
配置迁移(构造器,:63-70)
config.getCategory("client").remove("hardcoreEnderbacon");
config.moveProperty("general", "enableUpdateNotifications", "notifications");
config.moveProperty("general", "enableBuildCheck", "notifications");
旧键 client.hardcoreEnderbacon 被删除(不迁移),另两个键从 general 迁到 notifications。
数值
19 个配置项全表
| 配置节 | 键 | 类型 | 默认值 | 行 | 读入字段 / 处理 |
|---|---|---|---|---|---|
client |
compendiumSmoothText |
int | 0 | 83-86 | KnowledgeFragmentText.smoothRenderingMode(byte 强转) |
client |
hardcoreEnderbaconMode |
int | 0 | 90-94 | ModClientProxy.loadEnderbacon(n);注释:0 = 4 月 1 日启用,1 = 始终启用,2 = 从不启用;.setShowInGui(false) |
client |
enableMusic |
boolean | true |
95-99 | MusicManager.enableCustomMusic;需重启 |
client |
removeVanillaDelay |
boolean | false |
100-104 | MusicManager.removeVanillaDelay;需重启 |
notifications |
enableUpdateNotifications |
boolean | true |
115-118 | UpdateNotificationManager.enableNotifications |
notifications |
enableOneReportPerUpdate |
boolean | false |
119-122 | UpdateNotificationManager.enableOneReportPerUpdate |
notifications |
enableNewerMC |
boolean | false |
123-126 | UpdateNotificationManager.enableNewerMC |
notifications |
enableBuildCheck |
boolean | true |
127-130 | UpdateNotificationManager.enableBuildCheck |
general |
overpoweredMobs |
boolean | false |
138-141 | ModCommonProxy.opMobs |
general |
gooBattlesWater |
boolean | true |
142-145 | BlockEnderGoo.shouldBattleWater |
general |
enableTempleCaller |
boolean | true |
146-149 | ItemTempleCaller.isEnabled |
general |
allowVanillaDragonEggPickup |
boolean | false |
150-153 | BlockDragonEggCustom.allowVanillaDragonEggPickup |
general |
logDebuggingInfo |
boolean | false |
154-158 | Log.forceDebugEnabled |
general |
overrideWorldGen |
boolean | false |
161-165 | BiomeGenHardcoreEnd.overrideWorldGen;需重启 |
general |
overrideBiomeMobs |
boolean | false |
166-170 | BiomeGenHardcoreEnd.overrideMobLists;需重启 |
general |
overworldEndermanMultiplier |
double(存 float) | 1F |
171-175 | BiomeGenHardcoreEnd.overworldEndermanMultiplier(float 强转);需重启 |
general |
achievementStartId |
int | 3500 | 176-180 | ModCommonProxy.achievementStartId;.setShowInGui(false);见成就 |
general |
decompositionBlacklist |
String | "" |
181-186 | StardustDecomposition.addFromString(...);需重启 |
general |
IMC |
String[] | {"Write your message here"} |
189-193 | 逐条 HeeIMC.acceptString("HEE Configuration File", imc);.setShowInGui(false) |
节内计数:client 4 + notifications 4 + general 11 = 19。
achievementStartId = 3500 下,24 个成就占 achievement.hee.3540–3592、3 个挑战占 achievement.hee.3620–3622(偏移 +40 与 +120,见 system/achievements/AchievementManager.java:198、:210)。
交互
decompositionBlacklist 的第二次硬编码追加
StardustDecomposition.addFromString(
getString("decompositionBlacklist", "", "…").setRequiresMcRestart(true).getString());
StardustDecomposition.addFromString("minecraft:fire, ExtraUtilities:unstableingot, witchery:*");
(ConfigHandler.java:181-187)在读配置项之后,无条件再追加 3 条硬编码黑名单:minecraft:fire、ExtraUtilities:unstableingot、witchery:*(witchery:* 是通配整 mod)。
addFromString 用逗号切分、逐条 trim、跳过空串(mechanics/misc/StardustDecomposition.java:40-48),并对 minecraft 域或 Loader.isModLoaded(domain) 为真的条目打 warn 提示重复(:93、:111、:128)。
这不是重复键声明 —— 同一键
decompositionBlacklist只在:181-186出现一次;:187是一次独立的addFromString调用。
存盘
3 个加载方法末尾各自 if (config.hasChanged()) config.save();(:108、:132、:202)。没有「按字段 sendToServer」这类机制(grep -c sendToServer system/ConfigHandler.java → 0)。
三阶段校验记录
按「声明 → 赋值 → 是否有外部读者」核对全部 19 项:
- 声明:
config.get(currentCategory, key, …)形式的调用共 19 处(由上表逐行列出) - 赋值:19 项全部有赋值语句(5 个 boolean 用
getBoolValue直接赋给静态字段,14 项经Property链式方法后赋给静态字段或传入方法) - 外部读者:19 项的读入目标全部是别的类的 public/static 字段并被实际使用 ——
ModCommonProxy.opMobs(entity/boss/EntityBossDragon.java:160等)、ModCommonProxy.achievementStartId(AchievementManager.java:198)、BiomeGenHardcoreEnd.overrideWorldGen/overrideMobLists/overworldEndermanMultiplier(world/biome/BiomeGenHardcoreEnd.java、BiomeDecoratorHardcoreEnd.java:135、EntityList相关路径)、BlockEnderGoo.shouldBattleWater、ItemTempleCaller.isEnabled、BlockDragonEggCustom.allowVanillaDragonEggPickup、Log.forceDebugEnabled、KnowledgeFragmentText.smoothRenderingMode、MusicManager.enableCustomMusic/removeVanillaDelay、UpdateNotificationManager的 4 个字段、StardustDecomposition黑名单、HeeIMC.acceptString - 重复键:19 个键名互不重复(
client.hardcoreEnderbacon是被remove的历史键,不计入)
需要重启的 6 项
.setRequiresMcRestart(true) 共 6 项:客户端 2 项(enableMusic、removeVanillaDelay)+ 通用 4 项(overrideWorldGen、overrideBiomeMobs、overworldEndermanMultiplier、decompositionBlacklist)。其余 13 项改后立即生效(经 onConfigChanged → proxy.loadConfiguration() 重读)。