aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0971-General-ItemMeta-fixes.patch
diff options
context:
space:
mode:
authorGhast <[email protected]>2024-06-15 17:26:55 +0200
committerNassim Jahnke <[email protected]>2024-06-15 18:52:01 +0200
commitb4200387992e94d23766a061b999083946dec7b0 (patch)
tree0b3c18c698f991fc042fc79fd18a2c0d319b9bcd /patches/server/0971-General-ItemMeta-fixes.patch
parentfb511c698e5e7f2abe2732c0b58d47d4f92ca5c6 (diff)
downloadPaper-b4200387992e94d23766a061b999083946dec7b0.tar.gz
Paper-b4200387992e94d23766a061b999083946dec7b0.zip
Fix ItemMeta#removeEnchantments (#10886)
Diffstat (limited to 'patches/server/0971-General-ItemMeta-fixes.patch')
-rw-r--r--patches/server/0971-General-ItemMeta-fixes.patch13
1 files changed, 12 insertions, 1 deletions
diff --git a/patches/server/0971-General-ItemMeta-fixes.patch b/patches/server/0971-General-ItemMeta-fixes.patch
index 563ec07fd9..776e90997b 100644
--- a/patches/server/0971-General-ItemMeta-fixes.patch
+++ b/patches/server/0971-General-ItemMeta-fixes.patch
@@ -9,6 +9,8 @@ public net/minecraft/world/food/FoodProperties DEFAULT_EAT_SECONDS
public org/bukkit/craftbukkit/block/CraftBlockStates getBlockState(Lorg/bukkit/World;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)Lorg/bukkit/craftbukkit/block/CraftBlockState;
public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V
+Co-authored-by: GhastCraftHD <[email protected]>
+
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 486c3769a0e6a1ecb5530a35e2591f78776619b9..b800b03ae034b276740c3b41555a52b778ad9aad 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -828,7 +830,7 @@ index 97b7085250d749c5e46352b372068b51de89bc7f..7277e7ee566aabf6e01937072d949ed6
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
-index 8cfce9c557c4411914adffd10872bf3129435423..d2a7414f3ae9fb23a2f9f2ed7fd0a50a4aa3d7d9 100644
+index 8cfce9c557c4411914adffd10872bf3129435423..d9d4b983672b4340df926d98a7fa6708acad8a05 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -182,9 +182,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -895,6 +897,15 @@ index 8cfce9c557c4411914adffd10872bf3129435423..d2a7414f3ae9fb23a2f9f2ed7fd0a50a
this.lore = lore != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(lore) : null;
}
// Paper end
+@@ -1164,7 +1169,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+ @Override
+ public void removeEnchantments() {
+ if (this.hasEnchants()) {
+- this.enchantments.clear();
++ this.enchantments = null; // Paper - Correctly clear enchantments
+ }
+ }
+
@@ -1230,6 +1235,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
// Paper end
@Override