Attack
Play 0x01, client → server.
play · 0x01 · serverbound (client → server)
Sent when the player attacks (left-clicks) an entity with numeric entityId. The server checks reach and validity, then applies damage. This replaces the attack case of Interact; it usually comes with a Swing.
Sent by the client, read by the server. Listen for it with client.on("Attack", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
entityId |
VarInt |
Send it
await client.sendPacket("Attack", {
entityId: /* VarInt */,
});
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/play/serverbound/Attack.ts