Skip to content

AfterLivingEntityDeathEvent

Represents an event that occurs after a living entity has died, detailing the entity and the cause of death. This event cannot be canceled.

Example

local deathQueue = spell:collect("AfterLivingEntityDeathEvent")
while true do
    local evt = deathQueue:next()
    --- @cast evt AfterLivingEntityDeathEvent
    local dead = evt.entity
    spell.pos = dead.pos
    spell:execute("/particle minecraft:cherry_leaves ~ ~ ~ 0.2 1 0.2 1 100")
end

Fields

name: string Read-Only

The name of the event.

entity: Entity Read-Only

A reference to the entity that has died.

damageSource: DamageSource Read-Only

The source of damage that caused the entity's death.