S2APacketParticles .java

net.minecraft.network.play.server.S2APacketParticles (class): members: particleArguments, getParticleCount, getParticleSpeed, getParticleArgs, getXOffset.

net.minecraft.network.play.serverclass190 linesserver5.1 KB

Implements

API Surface (14)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
EnumParticleTypes getParticleType()
boolean isLongDistance()
double getXCoordinate()
double getYCoordinate()
double getZCoordinate()
float getXOffset()
float getYOffset()
float getZOffset()
float getParticleSpeed()
int getParticleCount()
int[] getParticleArgs()
void processPacket(INetHandlerPlayClient handler)

Fields & Constants (11)

particleType
xCoord
yCoord
zCoord
xOffset
yOffset
zOffset
particleSpeed
particleCount
longDistance
particleArguments

Code Graph: Dependencies (4)

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

Full Source

S2APacketParticles.java190 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.EnumParticleTypes;
8
9
public class S2APacketParticles implements Packet<INetHandlerPlayClient>
10
{
11
    private EnumParticleTypes particleType;
12
    private float xCoord;
13
    private float yCoord;
14
    private float zCoord;
15
    private float xOffset;
16
    private float yOffset;
17
    private float zOffset;
18
    private float particleSpeed;
19
    private int particleCount;
20
    private boolean longDistance;
21
22
    /**
23
     * These are the block/item ids and possibly metaData ids that are used to color or texture the particle.
24
     */
25
    private int[] particleArguments;
26
27
    public S2APacketParticles()
28
    {
29
    }
30
31
    public S2APacketParticles(EnumParticleTypes particleTypeIn, boolean longDistanceIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int... particleArgumentsIn)
32
    {
33
        this.particleType = particleTypeIn;
34
        this.longDistance = longDistanceIn;
35
        this.xCoord = x;
36
        this.yCoord = y;
37
        this.zCoord = z;
38
        this.xOffset = xOffsetIn;
39
        this.yOffset = yOffset;
40
        this.zOffset = zOffset;
41
        this.particleSpeed = particleSpeedIn;
42
        this.particleCount = particleCountIn;
43
        this.particleArguments = particleArgumentsIn;
44
    }
45
46
    /**
47
     * Reads the raw packet data from the data stream.
48
     */
49
    public void readPacketData(PacketBuffer buf) throws IOException
50
    {
51
        this.particleType = EnumParticleTypes.getParticleFromId(buf.readInt());
52
53
        if (this.particleType == null)
54
        {
55
            this.particleType = EnumParticleTypes.BARRIER;
56
        }
57
58
        this.longDistance = buf.readBoolean();
59
        this.xCoord = buf.readFloat();
60
        this.yCoord = buf.readFloat();
61
        this.zCoord = buf.readFloat();
62
        this.xOffset = buf.readFloat();
63
        this.yOffset = buf.readFloat();
64
        this.zOffset = buf.readFloat();
65
        this.particleSpeed = buf.readFloat();
66
        this.particleCount = buf.readInt();
67
        int i = this.particleType.getArgumentCount();
68
        this.particleArguments = new int[i];
69
70
        for (int j = 0; j < i; ++j)
71
        {
72
            this.particleArguments[j] = buf.readVarIntFromBuffer();
73
        }
74
    }
75
76
    /**
77
     * Writes the raw packet data to the data stream.
78
     */
79
    public void writePacketData(PacketBuffer buf) throws IOException
80
    {
81
        buf.writeInt(this.particleType.getParticleID());
82
        buf.writeBoolean(this.longDistance);
83
        buf.writeFloat(this.xCoord);
84
        buf.writeFloat(this.yCoord);
85
        buf.writeFloat(this.zCoord);
86
        buf.writeFloat(this.xOffset);
87
        buf.writeFloat(this.yOffset);
88
        buf.writeFloat(this.zOffset);
89
        buf.writeFloat(this.particleSpeed);
90
        buf.writeInt(this.particleCount);
91
        int i = this.particleType.getArgumentCount();
92
93
        for (int j = 0; j < i; ++j)
94
        {
95
            buf.writeVarIntToBuffer(this.particleArguments[j]);
96
        }
97
    }
98
99
    public EnumParticleTypes getParticleType()
100
    {
101
        return this.particleType;
102
    }
103
104
    public boolean isLongDistance()
105
    {
106
        return this.longDistance;
107
    }
108
109
    /**
110
     * Gets the x coordinate to spawn the particle.
111
     */
112
    public double getXCoordinate()
113
    {
114
        return (double)this.xCoord;
115
    }
116
117
    /**
118
     * Gets the y coordinate to spawn the particle.
119
     */
120
    public double getYCoordinate()
121
    {
122
        return (double)this.yCoord;
123
    }
124
125
    /**
126
     * Gets the z coordinate to spawn the particle.
127
     */
128
    public double getZCoordinate()
129
    {
130
        return (double)this.zCoord;
131
    }
132
133
    /**
134
     * Gets the x coordinate offset for the particle. The particle may use the offset for particle spread.
135
     */
136
    public float getXOffset()
137
    {
138
        return this.xOffset;
139
    }
140
141
    /**
142
     * Gets the y coordinate offset for the particle. The particle may use the offset for particle spread.
143
     */
144
    public float getYOffset()
145
    {
146
        return this.yOffset;
147
    }
148
149
    /**
150
     * Gets the z coordinate offset for the particle. The particle may use the offset for particle spread.
151
     */
152
    public float getZOffset()
153
    {
154
        return this.zOffset;
155
    }
156
157
    /**
158
     * Gets the speed of the particle animation (used in client side rendering).
159
     */
160
    public float getParticleSpeed()
161
    {
162
        return this.particleSpeed;
163
    }
164
165
    /**
166
     * Gets the amount of particles to spawn
167
     */
168
    public int getParticleCount()
169
    {
170
        return this.particleCount;
171
    }
172
173
    /**
174
     * Gets the particle arguments. Some particles rely on block and/or item ids and sometimes metadata ids to color or
175
     * texture the particle.
176
     */
177
    public int[] getParticleArgs()
178
    {
179
        return this.particleArguments;
180
    }
181
182
    /**
183
     * Passes this Packet on to the NetHandler for processing.
184
     */
185
    public void processPacket(INetHandlerPlayClient handler)
186
    {
187
        handler.handleParticles(this);
188
    }
189
}
190

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