mojira.dev
MC-131684

Chunk data packet allocates an extra byte for each section using GlobalPalette

The direct palette in the chunk data packet no longer writes anything to the packet buffer (instead of just writing a 0); this changed in 17w47a (the flattening). However, they still claim to have a serialized size of 1 byte. This means that the buffer allocated for the chunk data packet has between 1 and 16 extra bytes, one for the palette for each chunk section using the global palette.

In 1.12.2, what MCP calls BlockStatePaletteRegistry has this:

public void read(PacketBuffer buf)
    {
        buf.readVarInt();
    }

    public void write(PacketBuffer buf)
    {
        buf.writeVarInt(0);
    }

    public int getSerializedSize()
    {
        return PacketBuffer.getVarIntSize(0);
    }

In the current 1.13 snapshots, it instead has this:

public void read(PacketBuffer buf)
    {
    }

    public void write(PacketBuffer buf)
    {
    }

    public int getSerializedSize()
    {
        return PacketBuffer.getVarIntSize(0);
    }

The return PacketBuffer.getVarIntSize(0) should be changed to return 0.

Linked issues

Comments 3

Still an issue in 1.17.1 and 21w37a

Seems to have been fixed in 23w31a.

Can confirm, seems to be present in 1.20.1 and fixed in 23w31a looking at code (I haven't attempted to do anything with wireshark or similar to verify that way though)

pokechu22

(Unassigned)

Confirmed

Low

Networking

packet

Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, ..., 1.15.2, 1.16.3, 1.17.1, 21w37a, 1.18.1

23w31a

Retrieved