Damage Event
Play 0x19, server → client.
play · 0x19 · clientbound (server → client)
Tells the client that the entity entityId took damage from the damage type sourceTypeId, with optional cause and direct entity ids and an optional source position. The server sends it whenever a tracked entity is hurt. The client plays the hurt effects and uses the source to pick the death message and knockback direction.
Sent by the server, read by the client. Listen for it with client.on("DamageEvent", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
entityId |
VarInt | |
sourceTypeId |
VarInt | |
sourceCauseId |
VarInt | |
sourceDirectId |
VarInt | |
sourcePosition |
Optional |
Send it
await client.sendPacket("DamageEvent", {
entityId: /* VarInt */,
sourceTypeId: /* VarInt */,
sourceCauseId: /* VarInt */,
sourceDirectId: /* VarInt */,
sourcePosition: /* Optional */,
});
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/play/clientbound/DamageEvent.ts