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 Packet16BlockItemSwitch extends Packet {
8
9 public int itemInHandIndex;
10 public int itemId;
11 public int itemDamage;
12
13 public Packet16BlockItemSwitch() {
14 }
15
16 // pvn <= 6
17 public Packet16BlockItemSwitch(int i, int j) {
18 this.itemId = i;
19 this.itemDamage = j;
20 }
21
22 public void a(DataInputStream datainputstream) throws IOException {
23 if (this.pvn >= 7) {
24 this.itemInHandIndex = datainputstream.readShort();
25 } else {
26 this.itemDamage = datainputstream.readInt();
27 this.itemId = datainputstream.readShort();
28 }
29 }
30
31 public void a(DataOutputStream dataoutputstream) throws IOException {
32 if (this.pvn >= 7) {
33 dataoutputstream.writeShort(this.itemInHandIndex);
34 } else {
35 dataoutputstream.writeInt(this.itemDamage);
36 dataoutputstream.writeShort(this.itemId);
37 }
38 }
39
40 public void a(NetHandler nethandler) {
41 nethandler.a(this);
42 }
43
44 public int a() {
45 return this.pvn >= 7 ? 2 : 6;
46 }
47}