Interact
Play 0x1A, client → server.
play · 0x1A · serverbound (client → server)
Sent when the player right-clicks an entity. target is the entity id, the action is interact or interact-at (location is the hit point relative to the entity), hand is the hand used, and usingSecondaryAction is the sneak flag. The server runs the entity’s interaction logic (trade, mount, shear, and so on).
Sent by the client, read by the server. Listen for it with client.on("Interact", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
target |
VarInt | |
hand |
VarInt | |
location |
LpVec3 | also position |
usingSecondaryAction |
Boolean |
Send it
await client.sendPacket("Interact", {
target: /* VarInt */,
hand: /* VarInt */,
location: /* LpVec3 */,
usingSecondaryAction: /* Boolean */,
});
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/play/serverbound/Interact.ts