mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Add damage check for mending (#10631)
This commit is contained in:
parent
58e7ac939f
commit
f1693652c8
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ ServerPlayer handle = this.getHandle();
|
+ ServerPlayer handle = this.getHandle();
|
||||||
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
|
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
|
||||||
+ final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper
|
+ 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;
|
+ 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)) {
|
+ 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());
|
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
|
||||||
|
Loading…
Reference in New Issue
Block a user