Skip to content

模板与插槽

插槽物品配置定义哪些装备可以拥有宝石插槽、插槽的类型和数量、默认开放状态以及外观修改。文件位于 items/*.yml,文件名即为配置的内部标识。

配置字段

字段类型必填说明
idstring配置唯一 ID。
matchobject物品匹配规则。
slotslist插槽定义列表。
default_open_slotslist<integer>默认开放的插槽索引列表。
allowed_gem_typeslist允许镶嵌的宝石类型白名单。
max_same_typeinteger同类型宝石最大数量(0 = 不限制)。
max_same_idinteger同 ID 宝石最大数量。
guiobjectGUI 模板配置。
name_actionslist插槽激活后对物品名称的修改。
lore_actionslist插槽激活后对物品 Lore 的修改。

匹配规则(match)

字段说明
item_sources按物品来源匹配(格式 "提供者-物品ID")。
slot_groups按装备槽位组匹配(weapon/armor/offhand)。
lore_contains按 Lore 包含文本匹配(空列表表示不限制)。

插槽定义(slots)

字段说明
index插槽索引(从 0 开始,唯一)。
type插槽类型(决定哪些宝石可以镶嵌)。
display_name插槽在 GUI 中的显示名称。

默认开放插槽

default_open_slots 使用索引列表精确指定哪些插槽初始已开放:

yaml
# 只有索引 0 的插槽默认开放,其余需要通过开槽操作解锁
default_open_slots:
  - 0

未列出的插槽需要玩家通过开槽操作来解锁。

完整示例

yaml
id: "example_socket_item"

match:
  item_sources:
    - "minecraft-diamond_sword"
  slot_groups:
    - "weapon"
  lore_contains: []

slots:
  - index: 0
    type: "attack"
    display_name: "<red>攻击插槽</red>"
  - index: 1
    type: "universal"
    display_name: "<white>通用插槽</white>"
  - index: 2
    type: "defense"
    display_name: "<blue>防御插槽</blue>"

default_open_slots:
  - 0

allowed_gem_types:
  - "attack"
  - "defense"
  - "utility"
  - "universal"

max_same_type: 0
max_same_id: 1

gui:
  gem_template: "gem/default"
  open_template: "open/default"

name_actions:
  - action: "prepend_prefix"
    value: "<gold>✦</gold> "

lore_actions:
  - action: "append"
    content:
      - "<dark_gray>─────────────</dark_gray>"

设计建议

  • 不同装备类型使用不同配置,避免防具镶嵌武器宝石。
  • 高级装备可以给更多插槽,但搭配 default_open_slots 控制初始开放数量。
  • max_same_id: 1 防止重复镶嵌同一颗宝石。
  • 如果装备来自 EmakiItem,建议在 match.item_sources 中使用稳定物品 ID。
  • name_actionslore_actions 在物品拥有已开放插槽时生效,用于标识装备可镶嵌状态。