Skip to content

EntityDeathEvent

Namespace Mc.Scripting.Events · Kind struct (ref)

public ref struct EntityDeathEvent : IEvent

A living entity died.

Id 32
Key mc:entity_death
Cancellable no
Fired by the engine yes
Field Type Handlers may write Description
Entity Entity no (readonly) The entity.
Killer Entity no (readonly) The responsible entity (none if there is none).
DamageType key.damage_type no (readonly) The damage type key, e.g. minecraft:player_attack.
Cause enum:DamageCause no (readonly) The cause derived from the damage type.
Member Description
EntityDeathEvent(Entity entity, Entity killer, int damageType, DamageCause cause) Creates the event (for firing it from a plugin; native code builds its own).
public EntityDeathEvent(Entity entity, Entity killer, int damageType, DamageCause cause)

Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.

Parameters

Name Type Description
entity Entity
killer Entity
damageType int
cause DamageCause
Member Description
DamageCause Cause { get; } The cause derived from the damage type.
string DamageType { get; } The damage type key, e.g.
Entity Entity { get; } The entity.
Entity Killer { get; } The responsible entity (none if there is none).
static ushort CatalogueId { get; } Catalogue id (stable ABI).
static bool IsCancellable { get; } Whether handlers can cancel the event.
static string Key { get; } Registry key of the event.
public DamageCause Cause { get; }

The cause derived from the damage type.

public string DamageType { get; }

The damage type key, e.g. minecraft:player_attack. (a registry key such as “minecraft:damage”; resolved on first access).

public Entity Entity { get; }

The entity.

public Entity Killer { get; }

The responsible entity (none if there is none).

public static ushort CatalogueId { get; }

Catalogue id (stable ABI).

public static bool IsCancellable { get; }

Whether handlers can cancel the event.

public static string Key { get; }

Registry key of the event.

DamageCause · Entity · IEvent