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 Packet103SetSlot extends Packet {
8
9 public int a;
10 public int b;
11 public ItemStack c;
12
13 public Packet103SetSlot() {
14 }
15
16 public Packet103SetSlot(int i, int j, ItemStack itemstack) {
17 this.a = i;
18 this.b = j;
19 this.c = itemstack == null ? itemstack : itemstack.cloneItemStack();
20 }
21
22 public void a(NetHandler nethandler) {
23 nethandler.a(this);
24 }
25
26 public void a(DataInputStream datainputstream) throws IOException {
27 this.a = datainputstream.readByte();
28 this.b = datainputstream.readShort();
29 short short1 = datainputstream.readShort();
30
31 if (short1 >= 0) {
32 byte b0 = datainputstream.readByte();
33 short short2 = 0;
34 // uberbukkit
35 if (this.pvn >= 8) {
36 short2 = datainputstream.readShort();
37 } else {
38 short2 = datainputstream.readByte();
39 }
40
41 this.c = new ItemStack(short1, b0, short2);
42 } else {
43 this.c = null;
44 }
45 }
46
47 public void a(DataOutputStream dataoutputstream) throws IOException {
48 dataoutputstream.writeByte(this.a);
49 dataoutputstream.writeShort(this.b);
50 if (this.c == null) {
51 dataoutputstream.writeShort(-1);
52 } else {
53 dataoutputstream.writeShort(this.c.id);
54 dataoutputstream.writeByte(this.c.count);
55 // uberbukkit
56 if (this.pvn >= 8) {
57 dataoutputstream.writeShort(this.c.getData());
58 } else {
59 dataoutputstream.writeByte(this.c.getData());
60 }
61 }
62 }
63
64 public int a() {
65 // uberbukkit
66 return this.pvn >= 8 ? 8 : 7;
67 }
68}