0x22 S22PacketMultiBlockChange

Updates multiple blocks within a single chunk. More efficient than sending many S23 packets.

Clientbound (Server → Client) · PLAY · net/minecraft/network/play/server/S22PacketMultiBlockChange.java

Published 2026-06-18 · Updated 2026-10-14

worldchunkblock
Complete 6/8

Fields

FieldTypeDescription
chunkXint
chunkZint
changedBlocksShort[] + VarInt[]Array of (block coordinate, new block state) pairs

Wire Encoding

FieldTypeNotes
Chunk Xint
Chunk Zint
Record CountVarInt
Per-Record(short coords, VarInt state)Block position in chunk + new block state

MCP References

MCPNetHandlerPlayClient.handleMultiBlockChange()

Handler Interface

HNDINetHandlerPlayClient

Vanilla Source

S22PacketMultiBlockChange.java108 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.block.Block;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.network.Packet;
7
import net.minecraft.network.PacketBuffer;
8
import net.minecraft.network.play.INetHandlerPlayClient;
9
import net.minecraft.util.BlockPos;
10
import net.minecraft.world.ChunkCoordIntPair;
11
import net.minecraft.world.chunk.Chunk;
12
13
public class S22PacketMultiBlockChange implements Packet<INetHandlerPlayClient>
14
{
15
    private ChunkCoordIntPair chunkPosCoord;
16
    private S22PacketMultiBlockChange.BlockUpdateData[] changedBlocks;
17
18
    public S22PacketMultiBlockChange()
19
    {
20
    }
21
22
    public S22PacketMultiBlockChange(int p_i45181_1_, short[] crammedPositionsIn, Chunk chunkIn)
23
    {
24
        this.chunkPosCoord = new ChunkCoordIntPair(chunkIn.xPosition, chunkIn.zPosition);
25
        this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[p_i45181_1_];
26
27
        for (int i = 0; i < this.changedBlocks.length; ++i)
28
        {
29
            this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(crammedPositionsIn[i], chunkIn);
30
        }
31
    }
32
33
    /**
34
     * Reads the raw packet data from the data stream.
35
     */
36
    public void readPacketData(PacketBuffer buf) throws IOException
37
    {
38
        this.chunkPosCoord = new ChunkCoordIntPair(buf.readInt(), buf.readInt());
39
        this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[buf.readVarIntFromBuffer()];
40
41
        for (int i = 0; i < this.changedBlocks.length; ++i)
42
        {
43
            this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(buf.readShort(), (IBlockState)Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer()));
44
        }
45
    }
46
47
    /**
48
     * Writes the raw packet data to the data stream.
49
     */
50
    public void writePacketData(PacketBuffer buf) throws IOException
51
    {
52
        buf.writeInt(this.chunkPosCoord.chunkXPos);
53
        buf.writeInt(this.chunkPosCoord.chunkZPos);
54
        buf.writeVarIntToBuffer(this.changedBlocks.length);
55
56
        for (S22PacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks)
57
        {
58
            buf.writeShort(s22packetmultiblockchange$blockupdatedata.func_180089_b());
59
            buf.writeVarIntToBuffer(Block.BLOCK_STATE_IDS.get(s22packetmultiblockchange$blockupdatedata.getBlockState()));
60
        }
61
    }
62
63
    /**
64
     * Passes this Packet on to the NetHandler for processing.
65
     */
66
    public void processPacket(INetHandlerPlayClient handler)
67
    {
68
        handler.handleMultiBlockChange(this);
69
    }
70
71
    public S22PacketMultiBlockChange.BlockUpdateData[] getChangedBlocks()
72
    {
73
        return this.changedBlocks;
74
    }
75
76
    public class BlockUpdateData
77
    {
78
        private final short chunkPosCrammed;
79
        private final IBlockState blockState;
80
81
        public BlockUpdateData(short p_i45984_2_, IBlockState state)
82
        {
83
            this.chunkPosCrammed = p_i45984_2_;
84
            this.blockState = state;
85
        }
86
87
        public BlockUpdateData(short p_i45985_2_, Chunk chunkIn)
88
        {
89
            this.chunkPosCrammed = p_i45985_2_;
90
            this.blockState = chunkIn.getBlockState(this.getPos());
91
        }
92
93
        public BlockPos getPos()
94
        {
95
            return new BlockPos(S22PacketMultiBlockChange.this.chunkPosCoord.getBlock(this.chunkPosCrammed >> 12 & 15, this.chunkPosCrammed & 255, this.chunkPosCrammed >> 8 & 15));
96
        }
97
98
        public short func_180089_b()
99
        {
100
            return this.chunkPosCrammed;
101
        }
102
103
        public IBlockState getBlockState()
104
        {
105
            return this.blockState;
106
        }
107
    }
108
}

Deobfuscated MCP 1.8.9 source of S22PacketMultiBlockChange, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S22PacketMultiBlockChange.java) at build time and verified present.

Deep Dive

Role in the protocol

S22PacketMultiBlockChange batches block updates for one chunk. PlayerManager's chunk update tick collects changed positions into a short[] and sends a single packet: chunkX int, chunkZ int, record count VarInt, then per record a short crammed position and a VarInt block state id. The crammed short packs y in the low 8 bits, x in bits 12-15 and z in bits 8-11 (y | x<<12 | z<<8). It is the batched sibling of S23PacketBlockChange and the only efficient way the server pushes many block edits in one tick.

Vanilla handling

NetHandlerPlayClient.handleMultiBlockChange iterates the BlockUpdateData array and calls world.func_180503_b(position, state) for each record, a no-notify setBlockState. The chunk must already be loaded; the packet never triggers a chunk load. Render updates are not batched here, so rapid multi-block streams can cost a client more in re-renders than in parsing.

Why clients touch it

None of the 8 reference clients hook S22 in a module; the only non-vanilla hit is Rise 6.1.30/6.2.4 NetworkAPI registering the class (clientbound index 77). FastBreak-style sync modules (which wait for the server's block-change echo to confirm a broken block) exist in other clients but have no corpus presence here. Block-scanning features re-scan the loaded world rather than parse per-packet records, so the packet stays vanilla.

Exploit surface

Dropping or rewriting S22 records desyncs the client's block map from the server's. Scaffold and FastBreak flows depend on the S22 echo to re-sync ghost blocks; a client that ignores it keeps stale visuals and can misplace subsequent placements. The server never validates application, so the desync is invisible in the packet stream. The crammed short encoding is the one real parsing hazard for any module that does touch this packet.

Server-Side Handling

PlayerManager line 460 (Memeware/Nekoware/Sigma corpus) sends S22 with the tick's accumulated numBlocksToUpdate and locationOfBlockChange array to every player watching the chunk. Records carry the block state id resolved from Block.BLOCK_STATE_IDS at construction. There is no inbound handler: the packet is clientbound and the server never learns whether the client applied the changes.

Protocol Analysis

Record count is a VarInt; each record is a short crammed as y | x<<12 | z<<8 (x and z 4 bits each, y 8 bits) followed by a VarInt block state id. The short encoding is why records are bounded to 4096 per chunk. Arrival order within the packet is the order the server collected the edits; the client applies them sequentially with no sorting.

Anti-Cheat Landscape

No anti-cheat measures S22. Server-side block verification (NCP's 'block' checks) operates on the server's own world model and the player's dig/place packets, so client-side application of S22 is never audited. The practical detection surface is gameplay-based: a client that desyncs from S22 places ghost blocks that staff can see in replays.

implementation Implementation Cases

Batched block-change delivery with no module usage in the 8 reference clients. The only non-vanilla reference is the Rise 6.x NetworkAPI script registration; block-aware features re-scan the loaded world instead.

No module in the 8 clients registers a receive handler for S22. The only non-vanilla reference is the NetworkAPI class table entry in Rise 6.1.30 and 6.2.4.
All 8 clients keep the vanilla handler. Rise 6.x adds the NetworkAPI registration; Memeware, Nekoware, Sigma, Spicy and Tenacity differ only by vanilla source revision.

anticheat Anti-Cheat Checks

S22 batches up to 4096 block changes into one chunk-section update, the form the server uses for explosions, pistons and large world edits. Server-side anticheats treat it as a compensated-world mutation: the changed blocks must be applied to the replicated cache before any movement or visibility check runs, otherwise phase, scaffold and ray-trace checks would judge the player against a stale world. The corpus for S22 is the block-change pipeline (Grim CompensatedWorld, NCP BlockChangeTracker and BlockChangeListener, Hydro WorldTracker, Kauri BlockUpdateHandler, Intave MultiBlockChangeReader), all feeding the same cache that xray and phase detection query.

BlockChangeTracker and BlockChangeListener (NoCheatPlus) (Updated-NoCheatPlus-NoCheatPlus)

Compensated block cache: record every server block change, including S22 multi-block updates, with validity intervals so movement checks can tell whether a block existed at the time the player used it.

BlockChangeListener registers Bukkit events (piston extend and retract, redstone, entity block change, block form, player interact) and forwards each change into BlockChangeTracker.addBlockChange with a change id, tick and direction. The tracker stores per-coordinate linked lists of BlockChangeEntry objects that expire by tick; movement checks (SurvivalFly, Passable, Visible) query getBlockChangeEntry and matchBlockChange with a BlockChangeReference to test whether the block was solid at the player's position at move time.

Detects: Feeds ground and passable decisions; prevents false flags when a block was legitimately changed by an explosion or piston between the client's view and the server's world.

Source: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/changetracker/BlockChangeListener.java

Variations: Grim CompensatedWorld and Hydro WorldTracker are the same compensated cache in modern anticheats; Kauri BlockUpdateHandler applies S22 updates with a keepalive-action queue; Intave MultiBlockChangeReader decodes the packet into positions and block data for its BlockUpdateTracker.
CompensatedWorld block changes (Grim) (GrimAnticheat-Grim)

Apply S22 multi-block and S23 single-block changes to Grim's compensated world with transaction accuracy.

Block changes from the server, including multi-block-change batches, are queued and applied inside runSafely and applyBlockChanges at the correct transaction point, so the async world matches the client's view when movement simulation reads it; updateBlock writes combined block ids and getBlock and getBlockStateId serve every check that needs a block. Piston and chunk events route into the same cache, and unloaded-chunk regions are tracked for setback logic.

Detects: Keeps phase, ground-spoof and scaffold checks honest by presenting the block state the client actually had instead of the server's current state.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java

Variations: NCP BlockChangeTracker is the classic equivalent; Hydro WorldTracker applies single and multi block changes with the same transaction confirmation; Truthful CompensatedWorld forwards updates to a global world cache.
BlockUpdateHandler (Kauri) (funkemunky-KauriV3)

Maintain Kauri's per-player replicated world from server block updates, including the S22 multi-block-change packet.

PacketHandler feeds WrapperPlayServerBlockChange and WrapperPlayServerMultiBlockChange into runUpdate, which applies each encoded block to the current World object inside a keepalive action so the update lands at the right server tick; chunk data and bulk chunk data go through the same path. The replicated world stores WrappedBlock values in 16x384x16 Chunk arrays, and getBlock and getRelative queries serve the reach, phase and interaction checks.

Detects: Supplies the block truth for Kauri's checks; clients cannot fake the world because the cache is server-derived.

Source: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/block/BlockUpdateHandler.java

Variations: Grim CompensatedWorld and Hydro WorldTracker apply the same updates with transaction timing; Intave BlockUpdateTracker combines its packet readers with an acknowledgeBlockChange sequence to keep the cache in lockstep with 1.19+ sequenced block changes.
MultiBlockChangeReader (Intave) (intave-intave)

Decode the S22 packet into absolute block positions and block data for Intave's block update tracker.

CompiledPacketReader that reads either the 1.16.2+ section-relative encoding (section position plus 12-bit relative coordinates) or the legacy MultiBlockChangeInfo array, and exposes blockPositions() and blockDataList() to the BlockUpdateTracker, which applies them to the block cache and acknowledges the sequence number.

Detects: Feeds the block cache that Intave's interaction ray-trace, phase and physics checks query; no direct flag.

Source: intave-intave, src/main/java/de/jpx3/intave/packet/reader/MultiBlockChangeReader.java

Variations: Hydro WorldTracker handleMultiBlockChange and Kauri runUpdate(WrapperPlayServerMultiBlockChange) are the equivalent decode-and-apply paths; NCP BlockChangeListener converts the same updates into validity-timed entries.

Wiki Cross-Reference

Clientbound 0x22: chunkX and chunkZ ints, VarInt record count, batched records.

Each record is a crammed short plus VarInt block state from Block.BLOCK_STATE_IDS.

Crammed short packs x in bits 12-15, z in bits 8-11 and y in low 8 bits.

MCP 1.8.9 S22PacketMultiBlockChange implements Packet dispatching to INetHandlerPlayClient.handleMultiBlockChange; wire serde is readPacketData/writePacketData via readInt, readShort, readVarIntFromBuffer.

1.8.9 callers: PlayerManager.onUpdate sends new S22PacketMultiBlockChange (line 505): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/PlayerManager.java

Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.

Vanilla Internals

Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.