mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Correctly check enchants for ItemStack#damage (#11240)
This commit is contained in:
parent
e0bec73f14
commit
e574dc326d
1 changed files with 1 additions and 5 deletions
|
@ -28,11 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (player == null || !player.hasInfiniteMaterials() || force) { // Paper
|
||||
if (amount > 0) {
|
||||
int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent
|
||||
- amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
|
||||
+ if (!force) amount = EnchantmentHelper.processDurabilityChange(world, this, amount); // Paper - itemstack damage API - do not consider enchantments when damaging from API
|
||||
// CraftBukkit start
|
||||
if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||
PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper - Add EntityDamageItemEvent & Expand PlayerItemDamageEvent
|
||||
amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue