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.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/nms-patches/PacketDataSerializer.patch b/nms-patches/PacketDataSerializer.patch
new file mode 100644
index 00000000..20a1268c
--- /dev/null
+++ b/nms-patches/PacketDataSerializer.patch
@@ -0,0 +1,122 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/PacketDataSerializer.java 2014-11-27 08:59:46.809421371 +1100
++++ src/main/java/net/minecraft/server/PacketDataSerializer.java 2014-11-27 08:42:10.108850996 +1100
+@@ -8,7 +8,6 @@
+ import io.netty.buffer.ByteBufProcessor;
+ import io.netty.handler.codec.DecoderException;
+ import io.netty.handler.codec.EncoderException;
+-import io.netty.util.ReferenceCounted;
+ import java.io.DataInput;
+ import java.io.DataOutput;
+ import java.io.IOException;
+@@ -21,6 +20,8 @@
+ import java.nio.charset.Charset;
+ import java.util.UUID;
+
++import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
++
+ public class PacketDataSerializer extends ByteBuf {
+
+ private final ByteBuf a;
+@@ -142,7 +143,7 @@
+ } else {
+ try {
+ NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
+- } catch (IOException ioexception) {
++ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
+ throw new EncoderException(ioexception);
+ }
+ }
+@@ -162,7 +163,7 @@
+ }
+
+ public void 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 +190,11 @@
+
+ itemstack = new ItemStack(Item.getById(short0), b0, short1);
+ itemstack.setTag(this.h());
++ // CraftBukkit start
++ if (itemstack.getTag() != null) {
++ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
++ }
++ // CraftBukkit end
+ }
+
+ return itemstack;
+@@ -416,11 +422,11 @@
+ return this.a.getBytes(i, bytebuffer);
+ }
+
+- public ByteBuf getBytes(int i, OutputStream outputstream, int j) {
++ public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.getBytes(i, outputstream, j);
+ }
+
+- public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) {
++ public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.getBytes(i, gatheringbytechannel, j);
+ }
+
+@@ -484,11 +490,11 @@
+ return this.a.setBytes(i, bytebuffer);
+ }
+
+- public int setBytes(int i, InputStream inputstream, int j) {
++ public int setBytes(int i, InputStream inputstream, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.setBytes(i, inputstream, j);
+ }
+
+- public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) {
++ public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.setBytes(i, scatteringbytechannel, j);
+ }
+
+@@ -580,11 +586,11 @@
+ return this.a.readBytes(bytebuffer);
+ }
+
+- public ByteBuf readBytes(OutputStream outputstream, int i) {
++ public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.readBytes(outputstream, i);
+ }
+
+- public int readBytes(GatheringByteChannel gatheringbytechannel, int i) {
++ public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.readBytes(gatheringbytechannel, i);
+ }
+
+@@ -652,11 +658,11 @@
+ return this.a.writeBytes(bytebuffer);
+ }
+
+- public int writeBytes(InputStream inputstream, int i) {
++ public int writeBytes(InputStream inputstream, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.writeBytes(inputstream, i);
+ }
+
+- public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) {
++ public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.writeBytes(scatteringbytechannel, i);
+ }
+
+@@ -803,16 +809,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);
+- }
+ }