方块与物品开关

基本信息

属性 值
分类 Blocks、Items
读取方法 isBlockEnabled / isItemEnabled(RTConfiguration.java:295-301)
默认值 全部 true
方块键数 14(其中 1 个为孤儿键)
物品键数 19

功能

这两个分类用于按方块 / 按物品关闭内容。读取辅助方法(RTConfiguration.java:295-301):

private static boolean isBlockEnabled(String block) {
    return RTConfiguration.config.get("Blocks", block, true).getBoolean(true);
}
private static boolean isItemEnabled(String item) {
    return RTConfiguration.config.get("Items", item, true).getBoolean(true);
}

两个分类的默认值都是 true,即全部开启。GUI 由 RandomThingsGuiFactory 提供(Client/Config/RandomThingsGuiFactory.java,在 @Mod(guiFactory = ...) 中声明,RandomThings.java:62),可点击切换。

Blocks 分类(14 个键)

配置键 缓存字段 影响的方块 注册行
PlayerInterface playerInterface + creativePlayerInterface 玩家接口、创造模式玩家接口 :198
FluidDisplay fluidDisplay + advancedFluidDisplay 液体伪装方块、高级液体伪装方块 :199
FertilizedDirt fertilizedDirt + fertilizedDirtTilled 沃土(2 个变体) :200
ItemCollector itemCollector + advancedItemCollector 物品收集器、高级物品收集器 :201
OnlineDetector onlineDetector 在线侦测器 :202
MoonSensor moonSensor 月相传感器 :203
BloodmoonSensor bloodMoonSensor 血月传感器 :204
NotificationInterface notificationInterface 通知接口 :205
LapisLamp lapisLamp 青金石灯 :206
DyeingMachine dyeingMachine 混色机器 :207
SpectreGlass spectreGlass 灵魂玻璃 :208
EnergyDistributor energyDistributor 能量分配器 :209
EnderEnergyDistributor enderEnergyDistributor 末影能量分配器 :210
WirelessLever — 无线拉杆 见下方缺陷

注意 4 个键同时控制两个方块(PlayerInterface、FluidDisplay、FertilizedDirt、ItemCollector),因为它们在 ModBlocks.init() 中位于同一个 if 分支(ModBlocks.java:36-49)。

Items 分类(19 个键)

全部 19 个字段均正常赋值(RTConfiguration.java:213-231):

配置键 缓存字段 物品
BiomeSolution biomeCapsule 生物群系胶囊(配置名与注册名不同)
BiomePainter biomePainter 生物群系画刷
Whitestone whitestone 白石
MagneticForce magneticForce 磁力仪
VoidStone voidStone 虚空之石
DropFilter dropFilter 掉落物过滤器
EnderLetter enderLetter 末影邮件
SpectreKey spectreKey 灵魂之匙
OpSpectreKey opSpectreKey 管理者灵魂之匙
SoundRecorder soundRecorder 录音机
SpectreArmor spectreArmor 灵魂盔甲(4 件一组)
SpectreSword spectreSword 灵魂之剑
SpiritBinder spiritBinder 灵魂容器
CreativeSword creativeSword 创造模式之剑
CreativeGrower creativeGrower 创造模式之锄
CreativeChestGenerator creativeChestGenerator 箱子生成权杖
Imbues imbue 激素药水
Ginto ginto 银瓶
Bloodstone bloodStone 血石

无开关的内容

以下内容始终注册,不受配置影响:

内容 位置 注释
[沃土]两个变体 ModBlocks.java:44-45 共用 FertilizedDirt
幽灵方块 ModBlocks.java:62 // Always there
激素药水酿造台 ModBlocks.java:63 // Always there
过滤器 ModItems.java:79 在所有 if 之外
原料 ModItems.java:78 在所有 if 之外
5 个实体 ModEntitys.java:11-23 无条件注册
6 种激素效果 ModPotions.java:27-45 无条件注册

缺陷:Blocks.WirelessLever 键不存在

ConfigBlocks 声明了 15 个字段,但 syncConfig() 只赋值 14 个 —— wirelessLever 被漏掉,且 RTConfiguration.init() 也从未调用 isBlockEnabled("WirelessLever"),因此:

  • 配置文件中没有 Blocks.WirelessLever 这个键
  • ConfigBlocks.wirelessLever 恒为 false
  • 无线拉杆 不注册,其专用 Mixin MixinWorld 也不加载

可复现验证:

comm -23 <(sed -n 's/.*public static boolean *\([A-Za-z]*\).*/\1/p' Configuration/ConfigBlocks.java | sort -u) \
         <(sed -n '196,212p' Configuration/RTConfiguration.java \
            | grep -o 'ConfigBlocks\.[A-Za-z]*' | sed 's/ConfigBlocks\.//' | sort -u)
# → wirelessLever

同一比对在 ConfigItems.java 上输出为空(19 字段全部赋值),确认这是 ConfigBlocks 的孤立遗漏。详见 无线拉杆。

数值

数值名 值
方块键数 14(对应 15 个方块 ID)
物品键数 19(对应 21 个物品 ID)
默认值 全部 true
一键控两个方块 4 个键
孤儿键 1(WirelessLever)
始终注册内容 7 类

相关条目