Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import java.io.DataInputStream;
4import java.io.DataOutputStream;
5import java.io.IOException;
6
7public class Packet52MultiBlockChange extends Packet {
8
9 public int a;
10 public int b;
11 public short[] c;
12 public byte[] d;
13 public byte[] e;
14 public int f;
15
16 public Packet52MultiBlockChange() {
17 this.k = true;
18 }
19
20 public Packet52MultiBlockChange(int i, int j, short[] ashort, int k, World world) {
21 this.k = true;
22 this.a = i;
23 this.b = j;
24 this.f = k;
25 this.c = new short[k];
26 this.d = new byte[k];
27 this.e = new byte[k];
28 Chunk chunk = world.getChunkAt(i, j);
29
30 for (int l = 0; l < k; ++l) {
31 int i1 = ashort[l] >> 12 & 15;
32 int j1 = ashort[l] >> 8 & 15;
33 int k1 = ashort[l] & 255;
34
35 this.c[l] = ashort[l];
36 this.d[l] = (byte) chunk.getTypeId(i1, k1, j1);
37 this.e[l] = (byte) chunk.getData(i1, k1, j1);
38 }
39 }
40
41 public void a(DataInputStream datainputstream) throws IOException {
42 this.a = datainputstream.readInt();
43 this.b = datainputstream.readInt();
44 this.f = datainputstream.readShort() & '\uffff';
45 this.c = new short[this.f];
46 this.d = new byte[this.f];
47 this.e = new byte[this.f];
48
49 for (int i = 0; i < this.f; ++i) {
50 this.c[i] = datainputstream.readShort();
51 }
52
53 datainputstream.readFully(this.d);
54 datainputstream.readFully(this.e);
55 }
56
57 public void a(DataOutputStream dataoutputstream) throws IOException {
58 dataoutputstream.writeInt(this.a);
59 dataoutputstream.writeInt(this.b);
60 dataoutputstream.writeShort((short) this.f);
61
62 for (int i = 0; i < this.f; ++i) {
63 dataoutputstream.writeShort(this.c[i]);
64 }
65
66 dataoutputstream.write(this.d);
67 dataoutputstream.write(this.e);
68 }
69
70 public void a(NetHandler nethandler) {
71 nethandler.a(this);
72 }
73
74 public int a() {
75 return 10 + this.f * 4;
76 }
77}