S02PacketChat .java

net.minecraft.network.play.server.S02PacketChat (class): members: isChat, chatComponent, getChatComponent, getType, type, processPacket, readPacketData.

net.minecraft.network.play.serverclass74 linesserver1.7 KB

Implements

API Surface (6)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
IChatComponent getChatComponent()
boolean isChat()
byte getType()

Fields & Constants (2)

chatComponent
type

Code Graph: Dependencies (4)

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

Full Source

S02PacketChat.java74 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.network.Packet;
5
import net.minecraft.network.PacketBuffer;
6
import net.minecraft.network.play.INetHandlerPlayClient;
7
import net.minecraft.util.IChatComponent;
8
9
public class S02PacketChat implements Packet<INetHandlerPlayClient>
10
{
11
    private IChatComponent chatComponent;
12
    private byte type;
13
14
    public S02PacketChat()
15
    {
16
    }
17
18
    public S02PacketChat(IChatComponent component)
19
    {
20
        this(component, (byte)1);
21
    }
22
23
    public S02PacketChat(IChatComponent message, byte typeIn)
24
    {
25
        this.chatComponent = message;
26
        this.type = typeIn;
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.chatComponent = buf.readChatComponent();
35
        this.type = buf.readByte();
36
    }
37
38
    /**
39
     * Writes the raw packet data to the data stream.
40
     */
41
    public void writePacketData(PacketBuffer buf) throws IOException
42
    {
43
        buf.writeChatComponent(this.chatComponent);
44
        buf.writeByte(this.type);
45
    }
46
47
    /**
48
     * Passes this Packet on to the NetHandler for processing.
49
     */
50
    public void processPacket(INetHandlerPlayClient handler)
51
    {
52
        handler.handleChat(this);
53
    }
54
55
    public IChatComponent getChatComponent()
56
    {
57
        return this.chatComponent;
58
    }
59
60
    public boolean isChat()
61
    {
62
        return this.type == 1 || this.type == 2;
63
    }
64
65
    /**
66
     * Returns the id of the area to display the text, 2 for above the action bar, anything else currently for the chat
67
     * window
68
     */
69
    public byte getType()
70
    {
71
        return this.type;
72
    }
73
}
74

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