aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
new file mode 100644
index 0000000000..ce4b89510c
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
@@ -0,0 +1,43 @@
+--- a/net/minecraft/network/FriendlyByteBuf.java
++++ b/net/minecraft/network/FriendlyByteBuf.java
+@@ -81,6 +81,8 @@
+ import org.joml.Quaternionf;
+ import org.joml.Vector3f;
+
++import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
++
+ public class FriendlyByteBuf extends ByteBuf {
+
+ public static final int DEFAULT_NBT_QUOTA = 2097152;
+@@ -584,7 +586,7 @@
+ try {
+ NbtIo.writeAnyTag((Tag) tag, new ByteBufOutputStream(this));
+ return this;
+- } catch (IOException ioexception) {
++ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
+ throw new EncoderException(ioexception);
+ }
+ }
+@@ -611,8 +613,8 @@
+ }
+ }
+
+- public FriendlyByteBuf writeItem(ItemStack itemstack) {
+- if (itemstack.isEmpty()) {
++ public FriendlyByteBuf writeItem(ItemStack stack) {
++ if (stack.isEmpty() || stack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
+ this.writeBoolean(false);
+ } else {
+ this.writeBoolean(true);
+@@ -641,6 +643,11 @@
+ ItemStack itemstack = new ItemStack(item, b0);
+
+ itemstack.setTag(this.readNbt());
++ // CraftBukkit start
++ if (itemstack.getTag() != null) {
++ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
++ }
++ // CraftBukkit end
+ return itemstack;
+ }
+ }