跳到正文

掉落系统

掉落由“何时触发的规则”和“抽什么的掉落表”组成。总开关与原版规则默认关闭。

1. 原版实体规则

gameplay/loot/rules.yml

yaml
enabled: true

vanilla:
  enabled: true
  defaults: { delivery: killer, notification: actionbar }
  limits:
    max-selection-units-per-death: 2048
    max-generated-stacks-per-death: 64
  rules:
    zombie-example:
      enabled: true
      entity: ZOMBIE
      worlds: [world]
      spawn-reasons: [NATURAL, SPAWNER]
      delivery: killer
      notification: actionbar
      tables:
        - { table: zombie_equipment, trigger-chance: '10%' }

mythic:
  defaults: { delivery: ground, notification: actionbar }
  • entity 使用 Bukkit 实体类型。
  • worlds 是精确世界名列表。
  • spawn-reasons 限制生成原因。
  • delivery: killer 尝试给击杀者;ground 掉在地面。
  • notificationactionbarnone
  • trigger-chance 必须是带引号的概率串。
  • 两个 limits 是防止单次死亡配置膨胀的安全上限,不建议随意调大。

2. 掉落表

gameplay/loot/tables/zombie.yml

yaml
id: zombie_equipment
mode: weighted
rolls: 1
entries:
  - item: example_blade
    weight: 30
    amount: 1
    quality: epic
    identification: unidentified
  - item: identification_scroll
    weight: 70
    amount: { min: 1, max: 2 }
  • id 必须与规则中的 table 一致。
  • mode: weightedweight 相对权重选项。
  • rolls 是一次触发抽几轮。
  • amount 可为固定数或 { min, max }
  • quality 可强制品质,必须兼容该物品。
  • identification 可为 identifiedunidentified

30 与 70 是相对权重;在一轮 weighted 选择中约为 30% 与 70%,但表本身还受到规则的 10% 触发概率影响。

3. 概率计算例子

规则 10% 触发;表一轮 weighted;长剑权重 30/100。一次符合条件的僵尸死亡得到长剑的理论概率是 10% × 30% = 3%。卷轴条目数量 1..2 不改变抽中概率,只改变抽中后的数量。

4. 重载和测试

text
/si reload loot-rules
/si reload loot-tables
/si reload loot-messages

或全部:

text
/si reload loot

在指定世界用符合 spawn reason 的实体测试。通过命令刷出的实体可能不是 NATURAL/SPAWNER,不要因此误判规则坏了。

5. MythicMobs

安装 MythicMobs 后可使用 SealItems 自定义掉落桥。MythicMobs 自己的 Drops 配置维护触发概率与数量;当前 SealItems custom drop 只支持 ground 投放,不承诺 killer 直送。具体语法以当前注册的自定义掉落定义与启动日志为准。

6. 常见错误

  • enabledvanilla.enabled 仍是 false。
  • 规则引用的 table ID 与文件内 id 不一致。
  • 世界名大小写/拼写不同。
  • 实体生成原因不在列表。
  • 物品、品质 ID 不存在。
  • 把掉落表 entries 写进 rules.yml;两种文件结构不同。
  • 只测少量击杀就认定概率错误;先临时把 trigger-chance 设为 '100%' 验证链路,再恢复概率。

Minecraft 服务端插件使用与开发文档