mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 15:08:27 +02:00
123 lines
4.6 KiB
Diff
123 lines
4.6 KiB
Diff
--- ../work/decompile-8eb82bde//net/minecraft/server/PacketDataSerializer.java 2014-11-28 17:43:43.265707431 +0000
|
|
+++ src/main/java/net/minecraft/server/PacketDataSerializer.java 2014-11-28 17:38:23.000000000 +0000
|
|
@@ -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);
|
|
- }
|
|
}
|