aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
new file mode 100644
index 0000000000..471c61ca94
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/network/FriendlyByteBuf.java.patch
@@ -0,0 +1,54 @@
+--- a/net/minecraft/network/FriendlyByteBuf.java
++++ b/net/minecraft/network/FriendlyByteBuf.java
+@@ -80,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;
+ private final ByteBuf source;
+@@ -536,8 +586,8 @@
+ try {
+ NbtIo.writeAnyTag(tag, new ByteBufOutputStream(this));
+ return this;
+- } catch (IOException var3) {
+- throw new EncoderException(var3);
++ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
++ throw new EncoderException(ioexception);
+ }
+ }
+
+@@ -562,7 +614,7 @@
+ }
+
+ public FriendlyByteBuf writeItem(ItemStack stack) {
+- if (stack.isEmpty()) {
++ if (stack.isEmpty() || stack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
+ this.writeBoolean(false);
+ } else {
+ this.writeBoolean(true);
+@@ -584,11 +638,17 @@
+ if (!this.readBoolean()) {
+ return ItemStack.EMPTY;
+ } else {
+- Item item = this.readById(BuiltInRegistries.ITEM);
+- int _byte = this.readByte();
+- ItemStack itemStack = new ItemStack(item, _byte);
+- itemStack.setTag(this.readNbt());
+- return itemStack;
++ Item item = (Item) this.readById((IdMap) BuiltInRegistries.ITEM);
++ byte b0 = this.readByte();
++ 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;
+ }
+ }
+