0x34 S34PacketMaps

Updates a map item's data (pixels, colors).

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

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

mapitem
Complete 5/8

Fields

FieldTypeDescription
mapIdVarIntMap item damage value
databyte[]Map pixel colors

Wire Encoding

FieldTypeNotes
Map IDVarInt
Data LengthVarInt
Databyte[]Pixel colors + scale + coords + icons

MCP References

MCPNetHandlerPlayClient.handleMaps()

Handler Interface

HNDINetHandlerPlayClient

Vanilla Source

S34PacketMaps.java134 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import java.util.Collection;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
import net.minecraft.util.Vec4b;
9
import net.minecraft.world.storage.MapData;
10
11
public class S34PacketMaps implements Packet<INetHandlerPlayClient>
12
{
13
    private int mapId;
14
    private byte mapScale;
15
    private Vec4b[] mapVisiblePlayersVec4b;
16
    private int mapMinX;
17
    private int mapMinY;
18
    private int mapMaxX;
19
    private int mapMaxY;
20
    private byte[] mapDataBytes;
21
22
    public S34PacketMaps()
23
    {
24
    }
25
26
    public S34PacketMaps(int mapIdIn, byte scale, Collection<Vec4b> visiblePlayers, byte[] colors, int minX, int minY, int maxX, int maxY)
27
    {
28
        this.mapId = mapIdIn;
29
        this.mapScale = scale;
30
        this.mapVisiblePlayersVec4b = (Vec4b[])visiblePlayers.toArray(new Vec4b[visiblePlayers.size()]);
31
        this.mapMinX = minX;
32
        this.mapMinY = minY;
33
        this.mapMaxX = maxX;
34
        this.mapMaxY = maxY;
35
        this.mapDataBytes = new byte[maxX * maxY];
36
37
        for (int i = 0; i < maxX; ++i)
38
        {
39
            for (int j = 0; j < maxY; ++j)
40
            {
41
                this.mapDataBytes[i + j * maxX] = colors[minX + i + (minY + j) * 128];
42
            }
43
        }
44
    }
45
46
    /**
47
     * Reads the raw packet data from the data stream.
48
     */
49
    public void readPacketData(PacketBuffer buf) throws IOException
50
    {
51
        this.mapId = buf.readVarIntFromBuffer();
52
        this.mapScale = buf.readByte();
53
        this.mapVisiblePlayersVec4b = new Vec4b[buf.readVarIntFromBuffer()];
54
55
        for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i)
56
        {
57
            short short1 = (short)buf.readByte();
58
            this.mapVisiblePlayersVec4b[i] = new Vec4b((byte)(short1 >> 4 & 15), buf.readByte(), buf.readByte(), (byte)(short1 & 15));
59
        }
60
61
        this.mapMaxX = buf.readUnsignedByte();
62
63
        if (this.mapMaxX > 0)
64
        {
65
            this.mapMaxY = buf.readUnsignedByte();
66
            this.mapMinX = buf.readUnsignedByte();
67
            this.mapMinY = buf.readUnsignedByte();
68
            this.mapDataBytes = buf.readByteArray();
69
        }
70
    }
71
72
    /**
73
     * Writes the raw packet data to the data stream.
74
     */
75
    public void writePacketData(PacketBuffer buf) throws IOException
76
    {
77
        buf.writeVarIntToBuffer(this.mapId);
78
        buf.writeByte(this.mapScale);
79
        buf.writeVarIntToBuffer(this.mapVisiblePlayersVec4b.length);
80
81
        for (Vec4b vec4b : this.mapVisiblePlayersVec4b)
82
        {
83
            buf.writeByte((vec4b.func_176110_a() & 15) << 4 | vec4b.func_176111_d() & 15);
84
            buf.writeByte(vec4b.func_176112_b());
85
            buf.writeByte(vec4b.func_176113_c());
86
        }
87
88
        buf.writeByte(this.mapMaxX);
89
90
        if (this.mapMaxX > 0)
91
        {
92
            buf.writeByte(this.mapMaxY);
93
            buf.writeByte(this.mapMinX);
94
            buf.writeByte(this.mapMinY);
95
            buf.writeByteArray(this.mapDataBytes);
96
        }
97
    }
98
99
    /**
100
     * Passes this Packet on to the NetHandler for processing.
101
     */
102
    public void processPacket(INetHandlerPlayClient handler)
103
    {
104
        handler.handleMaps(this);
105
    }
106
107
    public int getMapId()
108
    {
109
        return this.mapId;
110
    }
111
112
    /**
113
     * Sets new MapData from the packet to given MapData param
114
     */
115
    public void setMapdataTo(MapData mapdataIn)
116
    {
117
        mapdataIn.scale = this.mapScale;
118
        mapdataIn.mapDecorations.clear();
119
120
        for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i)
121
        {
122
            Vec4b vec4b = this.mapVisiblePlayersVec4b[i];
123
            mapdataIn.mapDecorations.put("icon-" + i, vec4b);
124
        }
125
126
        for (int j = 0; j < this.mapMaxX; ++j)
127
        {
128
            for (int k = 0; k < this.mapMaxY; ++k)
129
            {
130
                mapdataIn.colors[this.mapMinX + j + (this.mapMinY + k) * 128] = this.mapDataBytes[j + k * this.mapMaxX];
131
            }
132
        }
133
    }
134
}

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

Deep Dive

Role in the protocol

S34PacketMaps delivers a map item's data: VarInt map id, byte scale, a collection of Vec4b map decorations (type, x, y, rotation), a short patch width, a short patch height, and the patch bytes, each a 4-bit palette index into the map color table. MapData builds it from the dirty column region; a full refresh goes out every fifth tick, incremental patches in between.

Vanilla handling

NetHandlerPlayClient.handleMaps looks up MapData by map id in the player's inventory, applies the column patch into the colors buffer, updates scale and decorations, and marks the map for re-render. MapData.func_176101_a (lines 244-246 in the bundled sources) constructs the packet; the 5-tick full refresh keeps the renderer honest when no patch traffic flows. The client trusts the patch dimensions and writes them into the render buffer directly.

Why clients touch it

None of the 8 clients has a module for this packet. The only non-vanilla hits are the Rise 6.x NetworkAPI script registration table (both 6.1.30 and 6.2.4) and the vanilla handler files. No ESP, no map exploit, no minimap integration consumes S34 in these corpora. Map pixels are world render data with no entity, inventory or movement signal, so cheat clients have nothing to gain from it.

Exploit surface

The only theoretical abuse is server-side: a malicious server can send patch dimensions that exceed the map buffer and stress the client renderer. That is a denial-of-service vector against the client, not a cheat surface, and no client in the corpus defends against it. No anti-cheat measures S34 because it carries no gameplay-trust signal.

Server-Side Handling

MapData.func_176101_a (lines 244-246) produces S34(mapId, scale, visible decorations, colors, minX, minY, width, height); a full refresh is emitted every fifth tick (field_176109_i % 5 == 0) and dirty-column patches in between. NetHandlerPlayClient.handleMaps resolves the MapData by id from the player's inventory, copies the patch into the colors array, refreshes scale and decorations, and triggers a re-render. The client applies the patch without validating dimensions.

Protocol Analysis

Wire: VarInt mapId, byte scale, VarInt icon count, then per icon a byte type, byte x, byte y, byte rotation, then short patch width, short patch height, then width x height bytes of 4-bit palette indexes. The patch is a dirty-column region; the full 128x128 refresh is a single patch with 16,384 bytes of indexes. PLAY state only, delivered to players who hold the map or stand near it.

Anti-Cheat Landscape

No anti-cheat touches S34: it is render data delivered to map holders and nearby players. The only risk is a malicious server sending oversized patches to load the client renderer, a server-side attack with no client cheat counterpart.

implementation Implementation Cases

Zero module hits in the 8 clients. Map pixel patches are pure render data; no ESP or map-exploit module consumes S34 in these corpora. The only non-vanilla reference is the Rise 6.x script API registration table.

No module hooks exist in the corpus. The packet reaches MapData exclusively through the vanilla handler.
Rise 6.1.30 and 6.2.4 register S34 in NetworkAPI for scripts; the other six clients carry only the vanilla handler.

anticheat Anti-Cheat Checks

No anti-cheat consumes S34. The corpus sweep for S34PacketMaps and PacketPlayOutMap returns only keyword noise from the chunk family: Artemis' HardcodeMap generator and its GPacketPlayServerChunkLoad and GPacketPlayServerChunkLoadBulk wrappers match on the PacketPlayOutMapChunk class names, and Kauri's BlockUpdateHandler Javadoc mentions a wrapped map-chunk packet. None of these read map item data. S34 is pure render state for players holding or standing near a map, with no movement, combat or inventory signal, so no check in any cloned anticheat references it.

Wiki Cross-Reference

Scale runs 0 to 4, where 0 is fully zoomed in at 1 block per pixel and 4 is fully zoomed out at 16 blocks per pixel.

Each map icon carries a type plus X and Z in map coordinates (-128 for the far edge to +127) and a direction of 0-15, where 0 is a vertical icon and each step rotates 22.5 degrees.

MCP 1.8.9 S34PacketMaps implements Packet dispatching to INetHandlerPlayClient.handleMaps; wire serde is readPacketData/writePacketData via readByte, readByteArray, readUnsignedByte, readVarIntFromBuffer.

1.8.9 callers: MapData.getPacket sends new S34PacketMaps (line 270): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/storage/MapData.java

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