API reference / @jsprismarine/prismarine / Events / EntityDeathEvent
Class: EntityDeathEvent
Defined in: prismarine/src/events/entity/EntityDeathEvent.ts:13
Fired once, when an entity's health has reached zero.
Not cancellable: by the time this runs the health is already gone and the client has been told, so a listener that "canceled" it would leave a corpse walking around with no hearts. What it is for is reacting - loot, statistics, an announcement - and for that, knowing who did it is the whole point, which is why the source is carried rather than only the cause.
Extends
Constructors
Constructor
new EntityDeathEvent(
entity,source):EntityDeathEvent
Defined in: prismarine/src/events/entity/EntityDeathEvent.ts:17
Parameters
entity
source
DamageSource
Returns
EntityDeathEvent
Overrides
Methods
getEntity()
getEntity():
Entity
Defined in: prismarine/src/events/entity/EntityDeathEvent.ts:25
Who died.
Returns
getSource()
getSource():
DamageSource
Defined in: prismarine/src/events/entity/EntityDeathEvent.ts:30
What killed them, and who is answerable for it.
Returns
DamageSource
isCanceled()
isCanceled():
boolean
Defined in: prismarine/src/events/Event.ts:12
Is the event canceled
Returns
boolean
Whether the event is canceled
Inherited from
preventDefault()
preventDefault():
void
Defined in: prismarine/src/events/Event.ts:19
Cancel the event
Returns
void