aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0715-Expand-PlayerItemDamageEvent.patch
blob: 9163d3de013d2cbf19b2c3aa390ae54d0874efcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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] Expand PlayerItemDamageEvent


diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 2f60e67de38bb4b39deb505f23e35aeff9eded73..0a883564b9dda4fa0e6a7174a6e46b98af8be3e6 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -661,10 +661,11 @@ public final class ItemStack implements DataComponentHolder {
                     }
                 }
 
+                int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent
                 amount -= k;
                 // CraftBukkit start
                 if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
-                    PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent
+                    PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper - Add EntityDamageItemEvent & Expand PlayerItemDamageEvent
                     event.getPlayer().getServer().getPluginManager().callEvent(event);
 
                     if (amount != event.getDamage() || event.isCancelled()) {