mirror of
https://github.com/PaperMC/Paper.git
synced 2024-10-31 16:00:18 +01:00
24 lines
1.5 KiB
Diff
24 lines
1.5 KiB
Diff
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 db94bbbd7f93afef46586e6314ebc666b7e6087c..9d43c37e345689d5e4c6cfcb00ab2b4da01eef56 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()) {
|