S0EPacketSpawnObject .java

net.minecraft.network.play.server.S0EPacketSpawnObject (class): members: field_149020_k, func_149002_g, func_149009_m, getSpeedX, getSpeedY, getSpeedZ.

net.minecraft.network.play.serverclass229 linesserver4.8 KB

Implements

API Surface (21)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
int getEntityID()
int getX()
int getY()
int getZ()
int getSpeedX()
int getSpeedY()
int getSpeedZ()
int getPitch()
int getYaw()
int getType()
int func_149009_m()
void setX(int newX)
void setY(int newY)
void setZ(int newZ)
void setSpeedX(int newSpeedX)
void setSpeedY(int newSpeedY)
void setSpeedZ(int newSpeedZ)
void func_149002_g(int p_149002_1_)

Fields & Constants (11)

entityId
x
y
z
speedX
speedY
speedZ
pitch
yaw
type
field_149020_k

Code Graph: Dependencies (5)

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

Full Source

S0EPacketSpawnObject.java229 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
import net.minecraft.util.MathHelper;
9
10
public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient>
11
{
12
    private int entityId;
13
    private int x;
14
    private int y;
15
    private int z;
16
    private int speedX;
17
    private int speedY;
18
    private int speedZ;
19
    private int pitch;
20
    private int yaw;
21
    private int type;
22
    private int field_149020_k;
23
24
    public S0EPacketSpawnObject()
25
    {
26
    }
27
28
    public S0EPacketSpawnObject(Entity entityIn, int typeIn)
29
    {
30
        this(entityIn, typeIn, 0);
31
    }
32
33
    public S0EPacketSpawnObject(Entity entityIn, int typeIn, int p_i45166_3_)
34
    {
35
        this.entityId = entityIn.getEntityId();
36
        this.x = MathHelper.floor_double(entityIn.posX * 32.0D);
37
        this.y = MathHelper.floor_double(entityIn.posY * 32.0D);
38
        this.z = MathHelper.floor_double(entityIn.posZ * 32.0D);
39
        this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
40
        this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
41
        this.type = typeIn;
42
        this.field_149020_k = p_i45166_3_;
43
44
        if (p_i45166_3_ > 0)
45
        {
46
            double d0 = entityIn.motionX;
47
            double d1 = entityIn.motionY;
48
            double d2 = entityIn.motionZ;
49
            double d3 = 3.9D;
50
51
            if (d0 < -d3)
52
            {
53
                d0 = -d3;
54
            }
55
56
            if (d1 < -d3)
57
            {
58
                d1 = -d3;
59
            }
60
61
            if (d2 < -d3)
62
            {
63
                d2 = -d3;
64
            }
65
66
            if (d0 > d3)
67
            {
68
                d0 = d3;
69
            }
70
71
            if (d1 > d3)
72
            {
73
                d1 = d3;
74
            }
75
76
            if (d2 > d3)
77
            {
78
                d2 = d3;
79
            }
80
81
            this.speedX = (int)(d0 * 8000.0D);
82
            this.speedY = (int)(d1 * 8000.0D);
83
            this.speedZ = (int)(d2 * 8000.0D);
84
        }
85
    }
86
87
    /**
88
     * Reads the raw packet data from the data stream.
89
     */
90
    public void readPacketData(PacketBuffer buf) throws IOException
91
    {
92
        this.entityId = buf.readVarIntFromBuffer();
93
        this.type = buf.readByte();
94
        this.x = buf.readInt();
95
        this.y = buf.readInt();
96
        this.z = buf.readInt();
97
        this.pitch = buf.readByte();
98
        this.yaw = buf.readByte();
99
        this.field_149020_k = buf.readInt();
100
101
        if (this.field_149020_k > 0)
102
        {
103
            this.speedX = buf.readShort();
104
            this.speedY = buf.readShort();
105
            this.speedZ = buf.readShort();
106
        }
107
    }
108
109
    /**
110
     * Writes the raw packet data to the data stream.
111
     */
112
    public void writePacketData(PacketBuffer buf) throws IOException
113
    {
114
        buf.writeVarIntToBuffer(this.entityId);
115
        buf.writeByte(this.type);
116
        buf.writeInt(this.x);
117
        buf.writeInt(this.y);
118
        buf.writeInt(this.z);
119
        buf.writeByte(this.pitch);
120
        buf.writeByte(this.yaw);
121
        buf.writeInt(this.field_149020_k);
122
123
        if (this.field_149020_k > 0)
124
        {
125
            buf.writeShort(this.speedX);
126
            buf.writeShort(this.speedY);
127
            buf.writeShort(this.speedZ);
128
        }
129
    }
130
131
    /**
132
     * Passes this Packet on to the NetHandler for processing.
133
     */
134
    public void processPacket(INetHandlerPlayClient handler)
135
    {
136
        handler.handleSpawnObject(this);
137
    }
138
139
    public int getEntityID()
140
    {
141
        return this.entityId;
142
    }
143
144
    public int getX()
145
    {
146
        return this.x;
147
    }
148
149
    public int getY()
150
    {
151
        return this.y;
152
    }
153
154
    public int getZ()
155
    {
156
        return this.z;
157
    }
158
159
    public int getSpeedX()
160
    {
161
        return this.speedX;
162
    }
163
164
    public int getSpeedY()
165
    {
166
        return this.speedY;
167
    }
168
169
    public int getSpeedZ()
170
    {
171
        return this.speedZ;
172
    }
173
174
    public int getPitch()
175
    {
176
        return this.pitch;
177
    }
178
179
    public int getYaw()
180
    {
181
        return this.yaw;
182
    }
183
184
    public int getType()
185
    {
186
        return this.type;
187
    }
188
189
    public int func_149009_m()
190
    {
191
        return this.field_149020_k;
192
    }
193
194
    public void setX(int newX)
195
    {
196
        this.x = newX;
197
    }
198
199
    public void setY(int newY)
200
    {
201
        this.y = newY;
202
    }
203
204
    public void setZ(int newZ)
205
    {
206
        this.z = newZ;
207
    }
208
209
    public void setSpeedX(int newSpeedX)
210
    {
211
        this.speedX = newSpeedX;
212
    }
213
214
    public void setSpeedY(int newSpeedY)
215
    {
216
        this.speedY = newSpeedY;
217
    }
218
219
    public void setSpeedZ(int newSpeedZ)
220
    {
221
        this.speedZ = newSpeedZ;
222
    }
223
224
    public void func_149002_g(int p_149002_1_)
225
    {
226
        this.field_149020_k = p_149002_1_;
227
    }
228
}
229

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