S24PacketBlockAction .java

net.minecraft.network.play.server.S24PacketBlockAction (class, 85 lines): members: instrument, getData1, getData2, getBlockPosition, blockPosition, block.

net.minecraft.network.play.serverclass85 linesserver2.0 KB

Implements

API Surface (7)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
BlockPos getBlockPosition()
int getData1()
int getData2()
Block getBlockType()

Fields & Constants (4)

blockPosition
instrument
pitch
block

Code Graph: Dependencies (5)

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

Full Source

S24PacketBlockAction.java85 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.block.Block;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
import net.minecraft.util.BlockPos;
9
10
public class S24PacketBlockAction implements Packet<INetHandlerPlayClient>
11
{
12
    private BlockPos blockPosition;
13
    private int instrument;
14
    private int pitch;
15
    private Block block;
16
17
    public S24PacketBlockAction()
18
    {
19
    }
20
21
    public S24PacketBlockAction(BlockPos blockPositionIn, Block blockIn, int instrumentIn, int pitchIn)
22
    {
23
        this.blockPosition = blockPositionIn;
24
        this.instrument = instrumentIn;
25
        this.pitch = pitchIn;
26
        this.block = blockIn;
27
    }
28
29
    /**
30
     * Reads the raw packet data from the data stream.
31
     */
32
    public void readPacketData(PacketBuffer buf) throws IOException
33
    {
34
        this.blockPosition = buf.readBlockPos();
35
        this.instrument = buf.readUnsignedByte();
36
        this.pitch = buf.readUnsignedByte();
37
        this.block = Block.getBlockById(buf.readVarIntFromBuffer() & 4095);
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.writeBlockPos(this.blockPosition);
46
        buf.writeByte(this.instrument);
47
        buf.writeByte(this.pitch);
48
        buf.writeVarIntToBuffer(Block.getIdFromBlock(this.block) & 4095);
49
    }
50
51
    /**
52
     * Passes this Packet on to the NetHandler for processing.
53
     */
54
    public void processPacket(INetHandlerPlayClient handler)
55
    {
56
        handler.handleBlockAction(this);
57
    }
58
59
    public BlockPos getBlockPosition()
60
    {
61
        return this.blockPosition;
62
    }
63
64
    /**
65
     * instrument data for noteblocks
66
     */
67
    public int getData1()
68
    {
69
        return this.instrument;
70
    }
71
72
    /**
73
     * pitch data for noteblocks
74
     */
75
    public int getData2()
76
    {
77
        return this.pitch;
78
    }
79
80
    public Block getBlockType()
81
    {
82
        return this.block;
83
    }
84
}
85

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