Remove ItemStack data, it has been merged into item ids

This commit is contained in:
Jonas Herzig 2018-07-18 23:19:09 +02:00
parent e34c31e7a9
commit a9574252e6
2 changed files with 4 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import java.util.Objects;
public class ItemStack {
private int id;
private int amount;
private int data;
private CompoundTag nbt;
public ItemStack(int id) {
@ -16,17 +15,12 @@ public class ItemStack {
}
public ItemStack(int id, int amount) {
this(id, amount, 0);
this(id, amount, null);
}
public ItemStack(int id, int amount, int data) {
this(id, amount, data, null);
}
public ItemStack(int id, int amount, int data, CompoundTag nbt) {
public ItemStack(int id, int amount, CompoundTag nbt) {
this.id = id;
this.amount = amount;
this.data = data;
this.nbt = nbt;
}
@ -38,10 +32,6 @@ public class ItemStack {
return this.amount;
}
public int getData() {
return this.data;
}
public CompoundTag getNBT() {
return this.nbt;
}
@ -54,13 +44,12 @@ public class ItemStack {
ItemStack that = (ItemStack) o;
return this.id == that.id &&
this.amount == that.amount &&
this.data == that.data &&
Objects.equals(this.nbt, that.nbt);
}
@Override
public int hashCode() {
return ObjectUtil.hashCode(this.id, this.amount, this.data, this.nbt);
return ObjectUtil.hashCode(this.id, this.amount, this.nbt);
}
@Override

View file

@ -74,7 +74,7 @@ public class NetUtil {
if(item < 0) {
return null;
} else {
return new ItemStack(item, in.readByte(), in.readShort(), readNBT(in));
return new ItemStack(item, in.readByte(), readNBT(in));
}
}
@ -84,7 +84,6 @@ public class NetUtil {
} else {
out.writeShort(item.getId());
out.writeByte(item.getAmount());
out.writeShort(item.getData());
writeNBT(out, item.getNBT());
}
}