S20PacketEntityProperties .java

net.minecraft.network.play.server.S20PacketEntityProperties (class, 128 lines): members: field_149444_b, func_149441_d, Snapshot, getEntityId, entityId.

net.minecraft.network.play.serverclass128 linesserver4.1 KB

Implements

API Surface (8)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
int getEntityId()
List<S20PacketEntityProperties.Snapshot> func_149441_d()
String func_151409_a()
double func_151410_b()
Collection<AttributeModifier> func_151408_c()

Fields & Constants (2)

entityId
field_149444_b

String literals (1)

"Unknown synced attribute modifier"

Code Graph: Dependencies (5)

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

Full Source

S20PacketEntityProperties.java128 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import com.google.common.collect.Lists;
4
import java.io.IOException;
5
import java.util.Collection;
6
import java.util.List;
7
import java.util.UUID;
8
import net.minecraft.entity.ai.attributes.AttributeModifier;
9
import net.minecraft.entity.ai.attributes.IAttributeInstance;
10
import net.minecraft.network.Packet;
11
import net.minecraft.network.PacketBuffer;
12
import net.minecraft.network.play.INetHandlerPlayClient;
13
14
public class S20PacketEntityProperties implements Packet<INetHandlerPlayClient>
15
{
16
    private int entityId;
17
    private final List<S20PacketEntityProperties.Snapshot> field_149444_b = Lists.<S20PacketEntityProperties.Snapshot>newArrayList();
18
19
    public S20PacketEntityProperties()
20
    {
21
    }
22
23
    public S20PacketEntityProperties(int entityIdIn, Collection<IAttributeInstance> p_i45236_2_)
24
    {
25
        this.entityId = entityIdIn;
26
27
        for (IAttributeInstance iattributeinstance : p_i45236_2_)
28
        {
29
            this.field_149444_b.add(new S20PacketEntityProperties.Snapshot(iattributeinstance.getAttribute().getAttributeUnlocalizedName(), iattributeinstance.getBaseValue(), iattributeinstance.func_111122_c()));
30
        }
31
    }
32
33
    /**
34
     * Reads the raw packet data from the data stream.
35
     */
36
    public void readPacketData(PacketBuffer buf) throws IOException
37
    {
38
        this.entityId = buf.readVarIntFromBuffer();
39
        int i = buf.readInt();
40
41
        for (int j = 0; j < i; ++j)
42
        {
43
            String s = buf.readStringFromBuffer(64);
44
            double d0 = buf.readDouble();
45
            List<AttributeModifier> list = Lists.<AttributeModifier>newArrayList();
46
            int k = buf.readVarIntFromBuffer();
47
48
            for (int l = 0; l < k; ++l)
49
            {
50
                UUID uuid = buf.readUuid();
51
                list.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", buf.readDouble(), buf.readByte()));
52
            }
53
54
            this.field_149444_b.add(new S20PacketEntityProperties.Snapshot(s, d0, list));
55
        }
56
    }
57
58
    /**
59
     * Writes the raw packet data to the data stream.
60
     */
61
    public void writePacketData(PacketBuffer buf) throws IOException
62
    {
63
        buf.writeVarIntToBuffer(this.entityId);
64
        buf.writeInt(this.field_149444_b.size());
65
66
        for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : this.field_149444_b)
67
        {
68
            buf.writeString(s20packetentityproperties$snapshot.func_151409_a());
69
            buf.writeDouble(s20packetentityproperties$snapshot.func_151410_b());
70
            buf.writeVarIntToBuffer(s20packetentityproperties$snapshot.func_151408_c().size());
71
72
            for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
73
            {
74
                buf.writeUuid(attributemodifier.getID());
75
                buf.writeDouble(attributemodifier.getAmount());
76
                buf.writeByte(attributemodifier.getOperation());
77
            }
78
        }
79
    }
80
81
    /**
82
     * Passes this Packet on to the NetHandler for processing.
83
     */
84
    public void processPacket(INetHandlerPlayClient handler)
85
    {
86
        handler.handleEntityProperties(this);
87
    }
88
89
    public int getEntityId()
90
    {
91
        return this.entityId;
92
    }
93
94
    public List<S20PacketEntityProperties.Snapshot> func_149441_d()
95
    {
96
        return this.field_149444_b;
97
    }
98
99
    public class Snapshot
100
    {
101
        private final String field_151412_b;
102
        private final double field_151413_c;
103
        private final Collection<AttributeModifier> field_151411_d;
104
105
        public Snapshot(String p_i45235_2_, double p_i45235_3_, Collection<AttributeModifier> p_i45235_5_)
106
        {
107
            this.field_151412_b = p_i45235_2_;
108
            this.field_151413_c = p_i45235_3_;
109
            this.field_151411_d = p_i45235_5_;
110
        }
111
112
        public String func_151409_a()
113
        {
114
            return this.field_151412_b;
115
        }
116
117
        public double func_151410_b()
118
        {
119
            return this.field_151413_c;
120
        }
121
122
        public Collection<AttributeModifier> func_151408_c()
123
        {
124
            return this.field_151411_d;
125
        }
126
    }
127
}
128

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