简体中文
掉落表
掉落表写在 loot_tables/*.yml, 也就是设定一只生物被打死之后掉什么
掉落表文件位于 plugins/EmakiMobs/loot_tables/*.yml, 通过 mob_id 字段和生物定义对应上. 首次启动释放的默认掉落表是 loot_tables/example_zombie.yml, 它的结构和下面那个完整示例一致
同名文件存在即生效
处理死亡掉落时, 插件按生物 id 直接去读本目录的 loot_tables/<mob_id>.yml, 和生物定义有没有写 loot_table 组件无关. 一旦读到, 死亡时会先清空全部原版掉落, 改由这张表的池产出 (击杀经验仍按 experience 保留). loot_table 组件只管设置原版/数据包掉落表, 见组件参考的"掉落类字段"
文件结构
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 字段
| 字段 | 类型 | 必填 | 默认值 | 取值范围 | 说明 |
|---|---|---|---|---|---|
mob_id | string | 是 | 无 | 已加载的生物定义 id (区分大小写) | 对应哪只生物; 为空或缺失时该文件会被记录 issue 并丢弃 |
pools | section | 否 | 空 | — | 池的集合; 键名随便叫什么都行, 只是个标识, 不参与掉落计算. 默认没写时这张表不产出任何掉落 |
pools.<池名> | section | 否 | 空 | — | 一个池; 不是映射结构的条目 (比如直接写一个字符串) 会被跳过 |
pools.<池名>.rolls | int 或数字字符串 | 否 | 1 | ≥ 1 (小于 1 按 1 处理) | 这只生物每次死亡时, 在本池里抽几次; 解析不成整数时会打 finest 日志, 并按 1 处理 |
pools.<池名>.entries | section | 否 | 空 | — | 条目的集合; 每次抽取都按权重从本池里选中一个条目 |
pools.<池名>.entries.<条目名> | section | 否 | 空 | — | 一个条目; 不是映射结构的条目会被跳过 |
entries 字段
| 字段 | 类型 | 必填 | 默认值 | 取值范围 | 说明 |
|---|---|---|---|---|---|
item | string | 否 | 无 | 原版材质名 (大小写不敏感, 可带命名空间) | 只按原版材质来匹配; 匹配失败时这个条目就掉不出东西 |
emaki_item | string | 否 | 无 | EmakiItem 物品 ID (不带前缀) | 需要装了 EmakiItem, 而且这个 id 已经在它的 items/ 里定义过. 没装时条目会被跳过, 并记录一次 emaki_item drops disabled |
weight | int | 否 | 1 | — | 抽取时的权重, 值越大越容易被选中. 权重 ≤ 0 的条目不会进入抽取池 (不报错) |
chance | double | 否 | 1.0 | 0.0–1.0 | 被选中之后还要再过一道概率: 0.5 表示有 50% 的概率真的掉落; ≥ 1.0 每次都通过 |
functions | section | 否 | 空 | — | 修改函数的集合; 键名随便叫什么都行, 只是个标识 |
item 和 emaki_item 至少要写一个, 两个都缺失或者都为空时, 整条条目会被跳过. 两个都写了的时候优先用 emaki_item (只有 EmakiItem 不可用或者解析失败时才回退到 item)
functions 字段
| 字段 | 类型 | 必填 | 默认值 | 取值范围 | 说明 |
|---|---|---|---|---|---|
type | string | 是 | 无 | set_count / looting_enchant | 函数的类型; 缺失时这个函数会被跳过, 其他取值也不生效 (忽略, 不报错) |
count.min | int | 否 | 1 | — | 数量区间的下界. set_count 会用; looting_enchant 不用这个值 |
count.max | int | 否 | 1 | — | 数量区间的上界. set_count 在 [min, max] 里随机取; looting_enchant 取 max × 掠夺等级 |
同一个函数的 count 子节缺失时, 两个端点都按 1 处理
set_count — 设置数量
yaml
functions:
count:
type: set_count
count:
min: 2
max: 5掉落 2 到 5 个该物品 (随机, 包含两端); max ≤ min 时固定为 min. 最终数量限制在物品的最大堆叠数以内
looting_enchant — 掠夺附魔加成
yaml
functions:
looting:
type: looting_enchant
count:
min: 0
max: 1击杀者主手武器的掠夺等级是 L (L = 0 时不生效) 时, 额外多掉 0 … count.max × L 个 (随机). looting_enchant 只用 count.max
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 键下
完整示例
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