S26PacketMapChunkBulk .java

net.minecraft.network.play.server.S26PacketMapChunkBulk (class): members: getChunkBytes, getChunkCount, getChunkSize, isOverworld, chunksData, xPositions.

net.minecraft.network.play.serverclass119 linesserver3.5 KB

Implements

API Surface (8)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
int getChunkX(int p_149255_1_)
int getChunkZ(int p_149253_1_)
int getChunkCount()
byte[] getChunkBytes(int p_149256_1_)
int getChunkSize(int p_179754_1_)

Fields & Constants (4)

xPositions
zPositions
chunksData
isOverworld

Code Graph: Dependencies (5)

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

Full Source

S26PacketMapChunkBulk.java119 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import java.util.List;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
import net.minecraft.world.chunk.Chunk;
9
10
public class S26PacketMapChunkBulk implements Packet<INetHandlerPlayClient>
11
{
12
    private int[] xPositions;
13
    private int[] zPositions;
14
    private S21PacketChunkData.Extracted[] chunksData;
15
    private boolean isOverworld;
16
17
    public S26PacketMapChunkBulk()
18
    {
19
    }
20
21
    public S26PacketMapChunkBulk(List<Chunk> chunks)
22
    {
23
        int i = chunks.size();
24
        this.xPositions = new int[i];
25
        this.zPositions = new int[i];
26
        this.chunksData = new S21PacketChunkData.Extracted[i];
27
        this.isOverworld = !((Chunk)chunks.get(0)).getWorld().provider.getHasNoSky();
28
29
        for (int j = 0; j < i; ++j)
30
        {
31
            Chunk chunk = (Chunk)chunks.get(j);
32
            S21PacketChunkData.Extracted s21packetchunkdata$extracted = S21PacketChunkData.getExtractedData(chunk, true, this.isOverworld, 65535);
33
            this.xPositions[j] = chunk.xPosition;
34
            this.zPositions[j] = chunk.zPosition;
35
            this.chunksData[j] = s21packetchunkdata$extracted;
36
        }
37
    }
38
39
    /**
40
     * Reads the raw packet data from the data stream.
41
     */
42
    public void readPacketData(PacketBuffer buf) throws IOException
43
    {
44
        this.isOverworld = buf.readBoolean();
45
        int i = buf.readVarIntFromBuffer();
46
        this.xPositions = new int[i];
47
        this.zPositions = new int[i];
48
        this.chunksData = new S21PacketChunkData.Extracted[i];
49
50
        for (int j = 0; j < i; ++j)
51
        {
52
            this.xPositions[j] = buf.readInt();
53
            this.zPositions[j] = buf.readInt();
54
            this.chunksData[j] = new S21PacketChunkData.Extracted();
55
            this.chunksData[j].dataSize = buf.readShort() & 65535;
56
            this.chunksData[j].data = new byte[S21PacketChunkData.func_180737_a(Integer.bitCount(this.chunksData[j].dataSize), this.isOverworld, true)];
57
        }
58
59
        for (int k = 0; k < i; ++k)
60
        {
61
            buf.readBytes(this.chunksData[k].data);
62
        }
63
    }
64
65
    /**
66
     * Writes the raw packet data to the data stream.
67
     */
68
    public void writePacketData(PacketBuffer buf) throws IOException
69
    {
70
        buf.writeBoolean(this.isOverworld);
71
        buf.writeVarIntToBuffer(this.chunksData.length);
72
73
        for (int i = 0; i < this.xPositions.length; ++i)
74
        {
75
            buf.writeInt(this.xPositions[i]);
76
            buf.writeInt(this.zPositions[i]);
77
            buf.writeShort((short)(this.chunksData[i].dataSize & 65535));
78
        }
79
80
        for (int j = 0; j < this.xPositions.length; ++j)
81
        {
82
            buf.writeBytes(this.chunksData[j].data);
83
        }
84
    }
85
86
    /**
87
     * Passes this Packet on to the NetHandler for processing.
88
     */
89
    public void processPacket(INetHandlerPlayClient handler)
90
    {
91
        handler.handleMapChunkBulk(this);
92
    }
93
94
    public int getChunkX(int p_149255_1_)
95
    {
96
        return this.xPositions[p_149255_1_];
97
    }
98
99
    public int getChunkZ(int p_149253_1_)
100
    {
101
        return this.zPositions[p_149253_1_];
102
    }
103
104
    public int getChunkCount()
105
    {
106
        return this.xPositions.length;
107
    }
108
109
    public byte[] getChunkBytes(int p_149256_1_)
110
    {
111
        return this.chunksData[p_149256_1_].data;
112
    }
113
114
    public int getChunkSize(int p_179754_1_)
115
    {
116
        return this.chunksData[p_179754_1_].dataSize;
117
    }
118
}
119

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