Death Condition

基本信息

属性 值
handler ID death
事件订阅 Forge MinecraftForge.EVENT_BUS(net.minecraftforge.event.entity.living.LivingDeathEvent)
优先级 LOWEST

配置字段

字段 类型 默认 含义
sources 字符串或字符串数组 [] 伤害源类型黑/白名单(event.source.getDamageType(),例如 "fall"、"drown"、"inFire")
isSourcesAllowList 布尔 false sources 是否为白名单(黑名单默认;为 true 时仅命中才触发)

Death handler 与 Attack handler 共享 AllowXOR 校验逻辑:sources.contains(damageType) ^ isSourcesAllowList。

触发条件

  • 玩家死亡:event.entityLiving instanceof EntityPlayer。
  • 同一种伤害源 + 同 allow-flag 的多个条目共享一份内部 DeathInfo,共享同一次触发时的 ID 集合。

JSON 示例

被摔死或溺水触发(黑名单示例):

{
  "id": "nasty_death",
  "x": 0, "y": 3,
  "icon": { "registryName": "minecraft:skeleton_skull" },
  "condition": {
    "type": "death",
    "sources": ["fall", "drown", "inFire"],
    "isSourcesAllowList": false
  }
}

相关条目

源码

src/main/java/glowredman/amazingtrophies/condition/DeathConditionHandler.java