S41PacketServerDifficulty .java

net.minecraft.network.play.server.S41PacketServerDifficulty (class, 58 lines): members: difficultyLocked, isDifficultyLocked, difficulty, getDifficulty.

net.minecraft.network.play.serverclass58 linesserver1.4 KB

Implements

API Surface (5)

void processPacket(INetHandlerPlayClient handler)
void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
boolean isDifficultyLocked()
EnumDifficulty getDifficulty()

Fields & Constants (2)

difficulty
difficultyLocked

Code Graph: Dependencies (4)

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

Full Source

S41PacketServerDifficulty.java58 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.world.EnumDifficulty;
8
9
public class S41PacketServerDifficulty implements Packet<INetHandlerPlayClient>
10
{
11
    private EnumDifficulty difficulty;
12
    private boolean difficultyLocked;
13
14
    public S41PacketServerDifficulty()
15
    {
16
    }
17
18
    public S41PacketServerDifficulty(EnumDifficulty difficultyIn, boolean lockedIn)
19
    {
20
        this.difficulty = difficultyIn;
21
        this.difficultyLocked = lockedIn;
22
    }
23
24
    /**
25
     * Passes this Packet on to the NetHandler for processing.
26
     */
27
    public void processPacket(INetHandlerPlayClient handler)
28
    {
29
        handler.handleServerDifficulty(this);
30
    }
31
32
    /**
33
     * Reads the raw packet data from the data stream.
34
     */
35
    public void readPacketData(PacketBuffer buf) throws IOException
36
    {
37
        this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
38
    }
39
40
    /**
41
     * Writes the raw packet data to the data stream.
42
     */
43
    public void writePacketData(PacketBuffer buf) throws IOException
44
    {
45
        buf.writeByte(this.difficulty.getDifficultyId());
46
    }
47
48
    public boolean isDifficultyLocked()
49
    {
50
        return this.difficultyLocked;
51
    }
52
53
    public EnumDifficulty getDifficulty()
54
    {
55
        return this.difficulty;
56
    }
57
}
58

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