C13PacketPlayerAbilities .java

net.minecraft.network.play.client.C13PacketPlayerAbilities (class): members: setCreativeMode, setAllowFlying, isAllowFlying, creativeMode, setWalkSpeed.

net.minecraft.network.play.clientclass136 linesclient3.1 KB

Implements

API Surface (13)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayServer handler)
boolean isInvulnerable()
void setInvulnerable(boolean isInvulnerable)
boolean isFlying()
void setFlying(boolean isFlying)
boolean isAllowFlying()
void setAllowFlying(boolean isAllowFlying)
boolean isCreativeMode()
void setCreativeMode(boolean isCreativeMode)
void setFlySpeed(float flySpeedIn)
void setWalkSpeed(float walkSpeedIn)

Fields & Constants (6)

invulnerable
flying
allowFlying
creativeMode
flySpeed
walkSpeed

Code Graph: Dependencies (4)

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

Full Source

C13PacketPlayerAbilities.java136 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.client;
2
3
import java.io.IOException;
4
import net.minecraft.entity.player.PlayerCapabilities;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayServer;
8
9
public class C13PacketPlayerAbilities implements Packet<INetHandlerPlayServer>
10
{
11
    private boolean invulnerable;
12
    private boolean flying;
13
    private boolean allowFlying;
14
    private boolean creativeMode;
15
    private float flySpeed;
16
    private float walkSpeed;
17
18
    public C13PacketPlayerAbilities()
19
    {
20
    }
21
22
    public C13PacketPlayerAbilities(PlayerCapabilities capabilities)
23
    {
24
        this.setInvulnerable(capabilities.disableDamage);
25
        this.setFlying(capabilities.isFlying);
26
        this.setAllowFlying(capabilities.allowFlying);
27
        this.setCreativeMode(capabilities.isCreativeMode);
28
        this.setFlySpeed(capabilities.getFlySpeed());
29
        this.setWalkSpeed(capabilities.getWalkSpeed());
30
    }
31
32
    /**
33
     * Reads the raw packet data from the data stream.
34
     */
35
    public void readPacketData(PacketBuffer buf) throws IOException
36
    {
37
        byte b0 = buf.readByte();
38
        this.setInvulnerable((b0 & 1) > 0);
39
        this.setFlying((b0 & 2) > 0);
40
        this.setAllowFlying((b0 & 4) > 0);
41
        this.setCreativeMode((b0 & 8) > 0);
42
        this.setFlySpeed(buf.readFloat());
43
        this.setWalkSpeed(buf.readFloat());
44
    }
45
46
    /**
47
     * Writes the raw packet data to the data stream.
48
     */
49
    public void writePacketData(PacketBuffer buf) throws IOException
50
    {
51
        byte b0 = 0;
52
53
        if (this.isInvulnerable())
54
        {
55
            b0 = (byte)(b0 | 1);
56
        }
57
58
        if (this.isFlying())
59
        {
60
            b0 = (byte)(b0 | 2);
61
        }
62
63
        if (this.isAllowFlying())
64
        {
65
            b0 = (byte)(b0 | 4);
66
        }
67
68
        if (this.isCreativeMode())
69
        {
70
            b0 = (byte)(b0 | 8);
71
        }
72
73
        buf.writeByte(b0);
74
        buf.writeFloat(this.flySpeed);
75
        buf.writeFloat(this.walkSpeed);
76
    }
77
78
    /**
79
     * Passes this Packet on to the NetHandler for processing.
80
     */
81
    public void processPacket(INetHandlerPlayServer handler)
82
    {
83
        handler.processPlayerAbilities(this);
84
    }
85
86
    public boolean isInvulnerable()
87
    {
88
        return this.invulnerable;
89
    }
90
91
    public void setInvulnerable(boolean isInvulnerable)
92
    {
93
        this.invulnerable = isInvulnerable;
94
    }
95
96
    public boolean isFlying()
97
    {
98
        return this.flying;
99
    }
100
101
    public void setFlying(boolean isFlying)
102
    {
103
        this.flying = isFlying;
104
    }
105
106
    public boolean isAllowFlying()
107
    {
108
        return this.allowFlying;
109
    }
110
111
    public void setAllowFlying(boolean isAllowFlying)
112
    {
113
        this.allowFlying = isAllowFlying;
114
    }
115
116
    public boolean isCreativeMode()
117
    {
118
        return this.creativeMode;
119
    }
120
121
    public void setCreativeMode(boolean isCreativeMode)
122
    {
123
        this.creativeMode = isCreativeMode;
124
    }
125
126
    public void setFlySpeed(float flySpeedIn)
127
    {
128
        this.flySpeed = flySpeedIn;
129
    }
130
131
    public void setWalkSpeed(float walkSpeedIn)
132
    {
133
        this.walkSpeed = walkSpeedIn;
134
    }
135
}
136

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