0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0051-Better-item-validation.patch
2024-10-23 02:15:00 +11:00

25 lines
1.2 KiB
Diff

From deb161c1237f9c927896f147c9bbd73865c7f45d Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Wed, 2 Jul 2014 23:35:51 +0100
Subject: [PATCH] Better item validation
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 3571860839..9b8632a664 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -183,6 +183,10 @@ public final class ItemStack implements DataComponentHolder {
registryfriendlybytebuf.writeVarInt(0);
} else {
registryfriendlybytebuf.writeVarInt(itemstack.getCount());
+ // Spigot start - filter
+ itemstack = itemstack.copy();
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
+ // Spigot end
ITEM_STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.getItemHolder()); // CraftBukkit - decompile error
DataComponentPatch.STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.components.asPatch());
}
--
2.47.0