From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: HexedHero <6012891+HexedHero@users.noreply.github.com> Date: Sun, 10 Apr 2022 06:26:32 +0100 Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 671af924e54e96e91a284103d5f347853ce338b6..90e4f8d21822cb0dc8bda586803f8c086f0fbeee 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -608,10 +608,11 @@ public final class ItemStack { } } + int originalDamage = amount; // Paper amount -= k; // CraftBukkit start if (player instanceof ServerPlayer serverPlayer) { // Paper - PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper + PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper event.getPlayer().getServer().getPluginManager().callEvent(event); if (amount != event.getDamage() || event.isCancelled()) {