Skip to content

掉落表

掉落表文件位于 plugins/EmakiMobs/loot_tables/*.yml,通过 mob_id 字段与生物定义关联。

文件结构

yaml
mob_id: <生物 id>   # 必须与生物定义的 id 完全一致

pools:
  <池名称>:
    rolls: <int>    # 每次死亡在本池中抽取的次数
    entries:
      <条目名称>:
        item: "<原版物品 ID>"   # 与 emaki_item 二选一
        # emaki_item: "<EmakiItem 物品 ID>"
        weight: <int>
        chance: <double>      # 可选:概率过滤
        functions:            # 可选:修改函数
          count:
            type: set_count
            count:
              min: <int>
              max: <int>
          looting:
            type: looting_enchant
            count:
              min: <int>
              max: <int>

pools 字段

每个 pools 下可定义任意数量的池,每个池独立抽取 rolls 次。

字段类型说明
rollsint本池每次生物死亡时的抽取次数。
entriesmap条目集合,每次抽取从中按权重选取一个。

entries 字段

字段类型默认值说明
itemstring原版物品,格式 minecraft:<id>。只走原版材质匹配。
emaki_itemstringEmakiItem 物品 ID,需安装 EmakiItem。
weightint1抽取权重,值越大被选中概率越高。
chancedouble1.0被选中后的额外概率过滤,范围 0.0–1.0。0.5 表示 50% 概率实际掉落。
functionsmap应用于条目的修改函数。

itememaki_item 至少要有一个,两者都缺失或都为空时整条条目被跳过。两者同时存在时优先取 emaki_item

functions 字段

set_count — 设置数量

yaml
functions:
  count:
    type: set_count
    count:
      min: 2
      max: 5

掉落 2–5 个该物品(随机)。

looting_enchant — 掠夺附魔加成

yaml
functions:
  looting:
    type: looting_enchant
    count:
      min: 0
      max: 1

击杀者每级掠夺附魔额外增加 0–1 个掉落数量。

EmakiItem 集成

掉落 EmakiItem 物品要用独立的 emaki_item 键,键值是纯物品 ID:

yaml
entries:
  elite_sword:
    emaki_item: "elite_iron_sword"   # EmakiItem 物品 ID,不带前缀
    weight: 1
    chance: 0.05                     # 5% 概率掉落

不要把 EmakiItem 物品写在 item 键下

item 只经过原版材质匹配,emakiitem:elite_iron_sword 匹配不到任何原版材质,该条目会静默不掉任何东西。EmakiItem 物品必须写在 emaki_item 键下。

NOTE

需要安装 EmakiItem 且 elite_iron_sword 已在 EmakiItem 的 items/ 目录中定义。未安装 EmakiItem 时 emaki_item 条目被跳过,并在日志中记录一次 emaki_item drops disabled

完整示例

yaml
mob_id: elite_zombie

pools:
  main:
    rolls: 1
    entries:
      rotten_flesh:
        item: "minecraft:rotten_flesh"
        weight: 10
        functions:
          count:
            type: set_count
            count:
              min: 2
              max: 5
          looting:
            type: looting_enchant
            count:
              min: 0
              max: 1
      iron_nugget:
        item: "minecraft:iron_nugget"
        weight: 4
        functions:
          count:
            type: set_count
            count:
              min: 2
              max: 4

  rare:
    rolls: 1
    entries:
      iron_sword:
        item: "minecraft:iron_sword"
        weight: 1
        chance: 0.15