C17PacketCustomPayload .java

net.minecraft.network.play.client.C17PacketCustomPayload (class): members: getChannelName, getBufferData, channel, data, processPacket, readPacketData.

net.minecraft.network.play.clientclass74 linesclient1.8 KB

Implements

API Surface (5)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayServer handler)
String getChannelName()
PacketBuffer getBufferData()

Fields & Constants (2)

channel
data

String literals (1)

"Payload may not be larger than 32767 bytes"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

C17PacketCustomPayload.java74 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.client;
2
3
import io.netty.buffer.ByteBuf;
4
import java.io.IOException;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayServer;
8
9
public class C17PacketCustomPayload implements Packet<INetHandlerPlayServer>
10
{
11
    private String channel;
12
    private PacketBuffer data;
13
14
    public C17PacketCustomPayload()
15
    {
16
    }
17
18
    public C17PacketCustomPayload(String channelIn, PacketBuffer dataIn)
19
    {
20
        this.channel = channelIn;
21
        this.data = dataIn;
22
23
        if (dataIn.writerIndex() > 32767)
24
        {
25
            throw new IllegalArgumentException("Payload may not be larger than 32767 bytes");
26
        }
27
    }
28
29
    /**
30
     * Reads the raw packet data from the data stream.
31
     */
32
    public void readPacketData(PacketBuffer buf) throws IOException
33
    {
34
        this.channel = buf.readStringFromBuffer(20);
35
        int i = buf.readableBytes();
36
37
        if (i >= 0 && i <= 32767)
38
        {
39
            this.data = new PacketBuffer(buf.readBytes(i));
40
        }
41
        else
42
        {
43
            throw new IOException("Payload may not be larger than 32767 bytes");
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.writeString(this.channel);
53
        buf.writeBytes((ByteBuf)this.data);
54
    }
55
56
    /**
57
     * Passes this Packet on to the NetHandler for processing.
58
     */
59
    public void processPacket(INetHandlerPlayServer handler)
60
    {
61
        handler.processVanilla250Packet(this);
62
    }
63
64
    public String getChannelName()
65
    {
66
        return this.channel;
67
    }
68
69
    public PacketBuffer getBufferData()
70
    {
71
        return this.data;
72
    }
73
}
74

Deobfuscated MCP 1.8.9 source of C17PacketCustomPayload from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C17PacketCustomPayload.java), stored verbatim.