C0CPacketInput .java

net.minecraft.network.play.client.C0CPacketInput (class, 92 lines): members: getForwardSpeed, getStrafeSpeed, forwardSpeed, strafeSpeed, sneaking, jumping.

net.minecraft.network.play.clientclass92 linesclient2.1 KB

Implements

API Surface (7)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayServer handler)
float getStrafeSpeed()
float getForwardSpeed()
boolean isJumping()
boolean isSneaking()

Fields & Constants (4)

strafeSpeed
forwardSpeed
jumping
sneaking

Code Graph: Dependencies (3)

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

Full Source

C0CPacketInput.java92 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 C0CPacketInput implements Packet<INetHandlerPlayServer>
9
{
10
    /** Positive for left strafe, negative for right */
11
    private float strafeSpeed;
12
13
    /** Positive for forward, negative for backward */
14
    private float forwardSpeed;
15
    private boolean jumping;
16
    private boolean sneaking;
17
18
    public C0CPacketInput()
19
    {
20
    }
21
22
    public C0CPacketInput(float strafeSpeed, float forwardSpeed, boolean jumping, boolean sneaking)
23
    {
24
        this.strafeSpeed = strafeSpeed;
25
        this.forwardSpeed = forwardSpeed;
26
        this.jumping = jumping;
27
        this.sneaking = sneaking;
28
    }
29
30
    /**
31
     * Reads the raw packet data from the data stream.
32
     */
33
    public void readPacketData(PacketBuffer buf) throws IOException
34
    {
35
        this.strafeSpeed = buf.readFloat();
36
        this.forwardSpeed = buf.readFloat();
37
        byte b0 = buf.readByte();
38
        this.jumping = (b0 & 1) > 0;
39
        this.sneaking = (b0 & 2) > 0;
40
    }
41
42
    /**
43
     * Writes the raw packet data to the data stream.
44
     */
45
    public void writePacketData(PacketBuffer buf) throws IOException
46
    {
47
        buf.writeFloat(this.strafeSpeed);
48
        buf.writeFloat(this.forwardSpeed);
49
        byte b0 = 0;
50
51
        if (this.jumping)
52
        {
53
            b0 = (byte)(b0 | 1);
54
        }
55
56
        if (this.sneaking)
57
        {
58
            b0 = (byte)(b0 | 2);
59
        }
60
61
        buf.writeByte(b0);
62
    }
63
64
    /**
65
     * Passes this Packet on to the NetHandler for processing.
66
     */
67
    public void processPacket(INetHandlerPlayServer handler)
68
    {
69
        handler.processInput(this);
70
    }
71
72
    public float getStrafeSpeed()
73
    {
74
        return this.strafeSpeed;
75
    }
76
77
    public float getForwardSpeed()
78
    {
79
        return this.forwardSpeed;
80
    }
81
82
    public boolean isJumping()
83
    {
84
        return this.jumping;
85
    }
86
87
    public boolean isSneaking()
88
    {
89
        return this.sneaking;
90
    }
91
}
92

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