aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-04-28 17:13:30 -0700
committerJake Potrebic <[email protected]>2024-04-28 17:13:30 -0700
commit69a971a35ca732ced862d91621f1682344618784 (patch)
tree60187835e4412fdb6c61af19f4cd2add3c0e800b
parent05308fc2992958a695194a6ec8c5815316015deb (diff)
downloadPaper-69a971a35ca732ced862d91621f1682344618784.tar.gz
Paper-69a971a35ca732ced862d91621f1682344618784.zip
Reset component prototype on itemtype change
-rw-r--r--patches/server/1045-General-ItemMeta-fixes.patch18
1 files changed, 18 insertions, 0 deletions
diff --git a/patches/server/1045-General-ItemMeta-fixes.patch b/patches/server/1045-General-ItemMeta-fixes.patch
index 0e8089834f..9338f6fe7d 100644
--- a/patches/server/1045-General-ItemMeta-fixes.patch
+++ b/patches/server/1045-General-ItemMeta-fixes.patch
@@ -3,7 +3,25 @@ From: Jake Potrebic <[email protected]>
Date: Sat, 27 Apr 2024 20:56:17 -0700
Subject: [PATCH] General ItemMeta fixes
+== AT ==
+private-f net/minecraft/world/item/ItemStack components
+diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
+index 8e2b3dd109dca3089cbce82cd3788874613a3230..a45389d64c04cd4c2a35fbc511595be0535a8665 100644
+--- a/src/main/java/net/minecraft/world/item/ItemStack.java
++++ b/src/main/java/net/minecraft/world/item/ItemStack.java
+@@ -1251,6 +1251,11 @@ public final class ItemStack implements DataComponentHolder {
+ public void setItem(Item item) {
+ this.bukkitStack = null; // Paper
+ this.item = item;
++ // Paper start - change base component prototype
++ final DataComponentPatch patch = this.getComponentsPatch();
++ this.components = new PatchedDataComponentMap(this.item.components());
++ this.applyComponents(patch);
++ // Paper end - change base component prototype
+ }
+ // CraftBukkit end
+
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index b0421823684ff6b9474b81675742d2ee3b17edf7..285257421a6958b854ecaa468ed275d33990db3d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java