From f1693652c8b6258656d8e7320966dc107d623b81 Mon Sep 17 00:00:00 2001 From: Andrew Teeter Date: Wed, 1 May 2024 06:01:48 -0400 Subject: [PATCH] Add damage check for mending (#10631) --- patches/server/Ability-to-apply-mending-to-XP-API.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/server/Ability-to-apply-mending-to-XP-API.patch b/patches/server/Ability-to-apply-mending-to-XP-API.patch index beaab26622..7f904db5f4 100644 --- a/patches/server/Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/Ability-to-apply-mending-to-XP-API.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ServerPlayer handle = this.getHandle(); + // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties + final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper -+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle); ++ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle, net.minecraft.world.item.ItemStack::isDamaged); + final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY; + if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_DAMAGE)) { + net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());