mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
9da047989c
By: md_5 <git@md-5.net>
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
--- a/net/minecraft/network/PacketDataSerializer.java
|
|
+++ b/net/minecraft/network/PacketDataSerializer.java
|
|
@@ -39,6 +39,8 @@
|
|
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
|
+
|
|
public class PacketDataSerializer extends ByteBuf {
|
|
|
|
private final ByteBuf a;
|
|
@@ -167,7 +169,7 @@
|
|
}
|
|
|
|
public <T extends Enum<T>> T a(Class<T> oclass) {
|
|
- return ((Enum[]) oclass.getEnumConstants())[this.i()];
|
|
+ return ((T[]) oclass.getEnumConstants())[this.i()]; // CraftBukkit - fix decompile error
|
|
}
|
|
|
|
public PacketDataSerializer a(Enum<?> oenum) {
|
|
@@ -244,7 +246,7 @@
|
|
} else {
|
|
try {
|
|
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
|
- } catch (IOException ioexception) {
|
|
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
|
throw new EncoderException(ioexception);
|
|
}
|
|
}
|
|
@@ -281,7 +283,7 @@
|
|
}
|
|
|
|
public PacketDataSerializer a(ItemStack itemstack) {
|
|
- if (itemstack.isEmpty()) {
|
|
+ if (itemstack.isEmpty() || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
|
this.writeBoolean(false);
|
|
} else {
|
|
this.writeBoolean(true);
|
|
@@ -310,6 +312,11 @@
|
|
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
|
|
|
|
itemstack.setTag(this.l());
|
|
+ // CraftBukkit start
|
|
+ if (itemstack.getTag() != null) {
|
|
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
return itemstack;
|
|
}
|
|
}
|