C03PacketPlayer .java

net.minecraft.network.play.client.C03PacketPlayer (class, 201 lines): members: C04PacketPlayerPosition, C06PacketPlayerPosLook, C05PacketPlayerLook, yaw.

net.minecraft.network.play.clientclass201 linesclient4.9 KB

Implements

API Surface (18)

void processPacket(INetHandlerPlayServer handler)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
double getPositionX()
double getPositionY()
double getPositionZ()
float getYaw()
float getPitch()
boolean isOnGround()
boolean isMoving()
boolean getRotating()
void setMoving(boolean isMoving)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)

Fields & Constants (8)

x
y
z
yaw
pitch
onGround
moving
rotating

Code Graph: Dependencies (3)

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

Full Source

C03PacketPlayer.java201 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.client;
2
3
import java.io.IOException;
4
import net.minecraft.network.Packet;
5
import net.minecraft.network.PacketBuffer;
6
import net.minecraft.network.play.INetHandlerPlayServer;
7
8
public class C03PacketPlayer implements Packet<INetHandlerPlayServer>
9
{
10
    protected double x;
11
    protected double y;
12
    protected double z;
13
    protected float yaw;
14
    protected float pitch;
15
    protected boolean onGround;
16
    protected boolean moving;
17
    protected boolean rotating;
18
19
    public C03PacketPlayer()
20
    {
21
    }
22
23
    public C03PacketPlayer(boolean isOnGround)
24
    {
25
        this.onGround = isOnGround;
26
    }
27
28
    /**
29
     * Passes this Packet on to the NetHandler for processing.
30
     */
31
    public void processPacket(INetHandlerPlayServer handler)
32
    {
33
        handler.processPlayer(this);
34
    }
35
36
    /**
37
     * Reads the raw packet data from the data stream.
38
     */
39
    public void readPacketData(PacketBuffer buf) throws IOException
40
    {
41
        this.onGround = buf.readUnsignedByte() != 0;
42
    }
43
44
    /**
45
     * Writes the raw packet data to the data stream.
46
     */
47
    public void writePacketData(PacketBuffer buf) throws IOException
48
    {
49
        buf.writeByte(this.onGround ? 1 : 0);
50
    }
51
52
    public double getPositionX()
53
    {
54
        return this.x;
55
    }
56
57
    public double getPositionY()
58
    {
59
        return this.y;
60
    }
61
62
    public double getPositionZ()
63
    {
64
        return this.z;
65
    }
66
67
    public float getYaw()
68
    {
69
        return this.yaw;
70
    }
71
72
    public float getPitch()
73
    {
74
        return this.pitch;
75
    }
76
77
    public boolean isOnGround()
78
    {
79
        return this.onGround;
80
    }
81
82
    public boolean isMoving()
83
    {
84
        return this.moving;
85
    }
86
87
    public boolean getRotating()
88
    {
89
        return this.rotating;
90
    }
91
92
    public void setMoving(boolean isMoving)
93
    {
94
        this.moving = isMoving;
95
    }
96
97
    public static class C04PacketPlayerPosition extends C03PacketPlayer
98
    {
99
        public C04PacketPlayerPosition()
100
        {
101
            this.moving = true;
102
        }
103
104
        public C04PacketPlayerPosition(double posX, double posY, double posZ, boolean isOnGround)
105
        {
106
            this.x = posX;
107
            this.y = posY;
108
            this.z = posZ;
109
            this.onGround = isOnGround;
110
            this.moving = true;
111
        }
112
113
        public void readPacketData(PacketBuffer buf) throws IOException
114
        {
115
            this.x = buf.readDouble();
116
            this.y = buf.readDouble();
117
            this.z = buf.readDouble();
118
            super.readPacketData(buf);
119
        }
120
121
        public void writePacketData(PacketBuffer buf) throws IOException
122
        {
123
            buf.writeDouble(this.x);
124
            buf.writeDouble(this.y);
125
            buf.writeDouble(this.z);
126
            super.writePacketData(buf);
127
        }
128
    }
129
130
    public static class C05PacketPlayerLook extends C03PacketPlayer
131
    {
132
        public C05PacketPlayerLook()
133
        {
134
            this.rotating = true;
135
        }
136
137
        public C05PacketPlayerLook(float playerYaw, float playerPitch, boolean isOnGround)
138
        {
139
            this.yaw = playerYaw;
140
            this.pitch = playerPitch;
141
            this.onGround = isOnGround;
142
            this.rotating = true;
143
        }
144
145
        public void readPacketData(PacketBuffer buf) throws IOException
146
        {
147
            this.yaw = buf.readFloat();
148
            this.pitch = buf.readFloat();
149
            super.readPacketData(buf);
150
        }
151
152
        public void writePacketData(PacketBuffer buf) throws IOException
153
        {
154
            buf.writeFloat(this.yaw);
155
            buf.writeFloat(this.pitch);
156
            super.writePacketData(buf);
157
        }
158
    }
159
160
    public static class C06PacketPlayerPosLook extends C03PacketPlayer
161
    {
162
        public C06PacketPlayerPosLook()
163
        {
164
            this.moving = true;
165
            this.rotating = true;
166
        }
167
168
        public C06PacketPlayerPosLook(double playerX, double playerY, double playerZ, float playerYaw, float playerPitch, boolean playerIsOnGround)
169
        {
170
            this.x = playerX;
171
            this.y = playerY;
172
            this.z = playerZ;
173
            this.yaw = playerYaw;
174
            this.pitch = playerPitch;
175
            this.onGround = playerIsOnGround;
176
            this.rotating = true;
177
            this.moving = true;
178
        }
179
180
        public void readPacketData(PacketBuffer buf) throws IOException
181
        {
182
            this.x = buf.readDouble();
183
            this.y = buf.readDouble();
184
            this.z = buf.readDouble();
185
            this.yaw = buf.readFloat();
186
            this.pitch = buf.readFloat();
187
            super.readPacketData(buf);
188
        }
189
190
        public void writePacketData(PacketBuffer buf) throws IOException
191
        {
192
            buf.writeDouble(this.x);
193
            buf.writeDouble(this.y);
194
            buf.writeDouble(this.z);
195
            buf.writeFloat(this.yaw);
196
            buf.writeFloat(this.pitch);
197
            super.writePacketData(buf);
198
        }
199
    }
200
}
201

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