diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch index 65c6d4fd97..45bd2fd2e6 100644 --- a/patches/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -108,6 +108,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 static boolean makeTag(net.minecraft.world.item.ItemStack item) { @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { + if (this.handle == null) { + return 0; + } +- return EnchantmentHelper.getItemEnchantmentLevel(CraftEnchantment.getRaw(ench), handle); ++ // Paper start - replace to allow custom enchantments ++ final ListTag enchantments = this.handle.getEnchantmentTags(); ++ for (int i = 0; i < enchantments.size(); i++) { ++ final CompoundTag tag = enchantments.getCompound(i); ++ final String id = tag.getString(CraftMetaItem.ENCHANTMENTS_ID.NBT); ++ final Enchantment enchant = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(id)); ++ if (ench.equals(enchant)) { ++ return EnchantmentHelper.getEnchantmentLevel(tag); ++ } ++ } ++ return 0; ++ // Paper end - replace to allow custom enchantments + } + + @Override public int removeEnchantment(Enchantment ench) { Preconditions.checkArgument(ench != null, "Enchantment cannot be null");