summaryrefslogtreecommitdiffstats
path: root/nms-patches/PacketDataSerializer.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/PacketDataSerializer.patch')
-rw-r--r--nms-patches/PacketDataSerializer.patch37
1 files changed, 10 insertions, 27 deletions
diff --git a/nms-patches/PacketDataSerializer.patch b/nms-patches/PacketDataSerializer.patch
index c66b7b58..3208a310 100644
--- a/nms-patches/PacketDataSerializer.patch
+++ b/nms-patches/PacketDataSerializer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PacketDataSerializer.java
+++ b/net/minecraft/server/PacketDataSerializer.java
-@@ -21,6 +21,8 @@
+@@ -20,6 +20,8 @@
import java.nio.charset.Charset;
import java.util.UUID;
@@ -9,16 +9,16 @@
public class PacketDataSerializer extends ByteBuf {
private final ByteBuf a;
-@@ -68,7 +70,7 @@
+@@ -99,7 +101,7 @@
}
public <T extends Enum<T>> T a(Class<T> oclass) {
-- return ((Enum[]) oclass.getEnumConstants())[this.e()];
-+ return ((T[]) oclass.getEnumConstants())[this.e()]; // CraftBukkit - fix decompile error
+- return ((Enum[]) oclass.getEnumConstants())[this.g()];
++ return ((T[]) oclass.getEnumConstants())[this.g()]; // CraftBukkit - fix decompile error
}
- public void a(Enum<?> oenum) {
-@@ -142,7 +144,7 @@
+ public PacketDataSerializer a(Enum<?> oenum) {
+@@ -176,7 +178,7 @@
} else {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@@ -27,19 +27,19 @@
throw new EncoderException(ioexception);
}
}
-@@ -162,7 +164,7 @@
+@@ -202,7 +204,7 @@
}
- public void a(ItemStack itemstack) {
+ public PacketDataSerializer a(ItemStack itemstack) {
- if (itemstack == null) {
+ if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
this.writeShort(-1);
} else {
this.writeShort(Item.getId(itemstack.getItem()));
-@@ -189,6 +191,11 @@
+@@ -230,6 +232,11 @@
itemstack = new ItemStack(Item.getById(short0), b0, short1);
- itemstack.setTag(this.h());
+ itemstack.setTag(this.j());
+ // CraftBukkit start
+ if (itemstack.getTag() != null) {
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
@@ -48,20 +48,3 @@
}
return itemstack;
-@@ -803,16 +810,4 @@
- public boolean release(int i) {
- return this.a.release(i);
- }
--
-- public ReferenceCounted retain(int i) {
-- return this.retain(i);
-- }
--
-- public ReferenceCounted retain() {
-- return this.retain();
-- }
--
-- public int compareTo(Object object) {
-- return this.compareTo((ByteBuf) object);
-- }
- }