BaublesConfig
基本信息
| 属性 | 值 |
|---|---|
| 路径 | baubles.common.BaublesConfig |
| 类型 | class |
| 包名 | baubles.common |
| 配置文件 | <mc>/config/Baubles.cfg |
默认静态字段
| 字段 | 默认值 | 说明 |
|---|---|---|
hideDebugItem |
true |
隐藏调试物品(ItemDebugger) |
soulBoundEnchantments |
int[] {} |
在饰品槽时被视为"灵魂绑定"的附魔 ID 列表 |
maxColumns |
4 |
客户端 GUI 中 bauble 槽位的最大列数 |
useOldGuiButton |
false |
使用旧的 baubles 按钮贴图与位置 |
useOldGuiRendering |
false |
使用旧的 baubles GUI(旧版不显示新扩展槽位视觉) |
showUnusedSlots |
false |
显示未分配的 unknown 类型槽位 |
manualSlotSelection |
false |
手动指定槽位分配(必须自己配置 slotTypeOverrides) |
displayTooltipOnHover |
true |
鼠标悬停在槽位上时显示槽位类型 tooltip |
slotStackLimitOverrides |
String[] {} |
每个槽位类型的堆叠上限,格式 type=limit |
slotUniversalOverrides |
String[] {} |
额外允许放入 universal 槽的类型列表 |
overrideSlotTypes |
[amulet, ring, ring, belt] |
当 manualSlotSelection=true 时实际使用的槽位分配 |
分类
| 分类 | 内容 |
|---|---|
debug |
hideDebugItem |
general |
soulBoundEnchantments |
client |
useOldGuiButton、useOldGuiRendering、maxColumns |
menu |
showUnusedSlots、manualSlotSelection、displayTooltipOnHover |
override |
defualtSlotTypes(自动写入)、slotTypeOverrides、slotStackLimitOverrides、slotUniversalOverrides |
方法
| 方法 | 用途 |
|---|---|
loadConfig(Configuration) |
在 init 事件期间从 Baubles.cfg 加载所有配置;如启用 manualSlotSelection 则立即调用 BaubleExpandedSlots.overrideSlots |
getStackLimitForSlotType(String) |
给定类型返回配置的 stack 上限,未配置返回 1 |
canTypeFitSlot(String itemType, String slotType) |
检查某物品类型能否放入某槽位;同类型、universal 类型或 slotType=universal && itemType ∈ slotUniversalOverrides 都返回 true |
getDisplayTypesWithUniversalOverrides(String[] types) |
把一个物品的可装备类型数组,扩展为展示用(含 universal 覆盖项),用于 tooltip 显示 |
关键行为
loadConfig在init阶段才执行(晚于通常的配置加载),目的是让BaubleExpandedSlots的 preinit 注册先完成defualtSlotTypes(拼写源自源码)每次启动时被自动覆写为当前[BaubleExpandedSlots.getCurrentSlotAssignments()](../api/bauble-expanded-slots)的内容;这是 mod 自动追踪 mod 注册的槽位分配并写回配置的手段slotStackLimitOverrides格式错误或未注册类型会被日志警告并忽略
相关条目
- BaubleExpandedSlots - 槽位分配的类型注册
- SlotBauble - 使用
getStackLimitForSlotType - InventoryBaubles - 使用
canTypeFitSlot校验可装备性 - ContainerPlayerExpanded - shift-click 优先级匹配使用本类
- GuiPlayerExpanded - 使用
displayTooltipOnHover、maxColumns、useOldGuiRendering