aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGhast <[email protected]>2024-06-15 17:26:55 +0200
committerGitHub <[email protected]>2024-06-15 17:26:55 +0200
commitaf7f0c49f38f9580ffb555d95f91dc201408d4c9 (patch)
treee02825ca32bb41b05c04e62a4bcb6aeabf5d86a2
parent3889ffb436763f80f829c9dc9e22ae61ca4a6e70 (diff)
downloadPaper-af7f0c49f38f9580ffb555d95f91dc201408d4c9.tar.gz
Paper-af7f0c49f38f9580ffb555d95f91dc201408d4c9.zip
Fix ItemMeta#removeEnchantments (#10886)
-rw-r--r--patches/server/1037-General-ItemMeta-fixes.patch13
-rw-r--r--patches/server/1045-Fix-equipment-slot-and-group-API.patch2
2 files changed, 13 insertions, 2 deletions
diff --git a/patches/server/1037-General-ItemMeta-fixes.patch b/patches/server/1037-General-ItemMeta-fixes.patch
index 610c8be06f..1419a0790f 100644
--- a/patches/server/1037-General-ItemMeta-fixes.patch
+++ b/patches/server/1037-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 066feef97f92b3f788dd6d25d188f2cc36fc4c80..7c7b9b1e0b604b0164b431873e6753b60421f970 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -830,7 +832,7 @@ index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..77489c3ffaa3a72d4cf105499a77150f
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
-index 705d7365a7bab9fe29b90a175040e6a1623e21a7..8ccb8d71ee489891e8d9128a5520675dd3a62786 100644
+index 5d86861a0df7308ae9b8440e5d9136fa7c8f1835..7d15711ffc908dff8a01f2425d729b449c5ed617 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -175,9 +175,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -906,6 +908,15 @@ index 705d7365a7bab9fe29b90a175040e6a1623e21a7..8ccb8d71ee489891e8d9128a5520675d
this.lore = lore != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(lore) : null;
}
// Paper end
+@@ -1094,7 +1099,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
+ }
+ }
+
@@ -1160,6 +1165,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
// Paper end
@Override
diff --git a/patches/server/1045-Fix-equipment-slot-and-group-API.patch b/patches/server/1045-Fix-equipment-slot-and-group-API.patch
index 68fc2e9c0f..dcd8b77c45 100644
--- a/patches/server/1045-Fix-equipment-slot-and-group-API.patch
+++ b/patches/server/1045-Fix-equipment-slot-and-group-API.patch
@@ -32,7 +32,7 @@ index 9d74577af071954e1e37201a96368c1360076209..eafa54c870c3e2aef30c3f9f96f51660
throw new IllegalArgumentException("Not implemented. This is a bug");
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
-index 8ccb8d71ee489891e8d9128a5520675dd3a62786..ad51c62b80bfd8f09c57e9ed1e73aad12341293a 100644
+index 7d15711ffc908dff8a01f2425d729b449c5ed617..b6686a42fe1eb29e00907105291e9e4a0baa08e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1367,7 +1367,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {