Block Update
Play 0x08, server → client.
play · 0x08 · clientbound (server → client)
Changes a single block at location to the block state type. The server sends it when a block changes outside of chunk loading, such as when a player places or breaks a block. The client updates the block in its world and rerenders the chunk section.
Sent by the server, read by the client. Listen for it with client.on("BlockUpdate", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
location |
Position | also position |
type |
VarInt | also subscriptionType |
Send it
import { helpers } from "mc-protocol";
// Stone at (10, 64, -3).
await client.sendPacket("BlockUpdate", {
location: { x: 10, y: 64, z: -3 },
type: helpers.getBlockStateId("stone"),
});
// Air (state ID 0) removes the block.
await client.sendPacket("BlockUpdate", { location: { x: 10, y: 64, z: -3 }, type: 0 });
type is a block state ID, not a block ID; helpers.getBlockStateId resolves names and properties. The chunk must already be loaded on the client. Send SectionBlocksUpdate for many blocks in one section.
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/play/clientbound/BlockUpdate.ts