S37PacketStatistics .java

net.minecraft.network.play.server.S37PacketStatistics (class): members: field_148976_a, func_148974_c, processPacket, readPacketData, writePacketData.

net.minecraft.network.play.serverclass73 linesserver2.0 KB

Implements

API Surface (4)

void processPacket(INetHandlerPlayClient handler)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
Map<StatBase, Integer> func_148974_c()

Fields & Constants (1)

field_148976_a

Code Graph: Dependencies (5)

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

Full Source

S37PacketStatistics.java73 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import com.google.common.collect.Maps;
4
import java.io.IOException;
5
import java.util.Map;
6
import java.util.Map.Entry;
7
import net.minecraft.network.Packet;
8
import net.minecraft.network.PacketBuffer;
9
import net.minecraft.network.play.INetHandlerPlayClient;
10
import net.minecraft.stats.StatBase;
11
import net.minecraft.stats.StatList;
12
13
public class S37PacketStatistics implements Packet<INetHandlerPlayClient>
14
{
15
    private Map<StatBase, Integer> field_148976_a;
16
17
    public S37PacketStatistics()
18
    {
19
    }
20
21
    public S37PacketStatistics(Map<StatBase, Integer> p_i45173_1_)
22
    {
23
        this.field_148976_a = p_i45173_1_;
24
    }
25
26
    /**
27
     * Passes this Packet on to the NetHandler for processing.
28
     */
29
    public void processPacket(INetHandlerPlayClient handler)
30
    {
31
        handler.handleStatistics(this);
32
    }
33
34
    /**
35
     * Reads the raw packet data from the data stream.
36
     */
37
    public void readPacketData(PacketBuffer buf) throws IOException
38
    {
39
        int i = buf.readVarIntFromBuffer();
40
        this.field_148976_a = Maps.<StatBase, Integer>newHashMap();
41
42
        for (int j = 0; j < i; ++j)
43
        {
44
            StatBase statbase = StatList.getOneShotStat(buf.readStringFromBuffer(32767));
45
            int k = buf.readVarIntFromBuffer();
46
47
            if (statbase != null)
48
            {
49
                this.field_148976_a.put(statbase, Integer.valueOf(k));
50
            }
51
        }
52
    }
53
54
    /**
55
     * Writes the raw packet data to the data stream.
56
     */
57
    public void writePacketData(PacketBuffer buf) throws IOException
58
    {
59
        buf.writeVarIntToBuffer(this.field_148976_a.size());
60
61
        for (Entry<StatBase, Integer> entry : this.field_148976_a.entrySet())
62
        {
63
            buf.writeString(((StatBase)entry.getKey()).statId);
64
            buf.writeVarIntToBuffer(((Integer)entry.getValue()).intValue());
65
        }
66
    }
67
68
    public Map<StatBase, Integer> func_148974_c()
69
    {
70
        return this.field_148976_a;
71
    }
72
}
73

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