2022-04-18 11:51:45 +02:00
|
|
|
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
|
2024-01-18 18:52:00 +01:00
|
|
|
Subject: [PATCH] Expand PlayerItemDamageEvent
|
2022-04-18 11:51:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
2024-04-27 04:09:42 +02:00
|
|
|
index 2f60e67de38bb4b39deb505f23e35aeff9eded73..0a883564b9dda4fa0e6a7174a6e46b98af8be3e6 100644
|
2022-04-18 11:51:45 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
2024-04-27 00:08:35 +02:00
|
|
|
@@ -661,10 +661,11 @@ public final class ItemStack implements DataComponentHolder {
|
2022-04-18 11:51:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-18 18:52:00 +01:00
|
|
|
+ int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent
|
2022-04-18 11:51:45 +02:00
|
|
|
amount -= k;
|
|
|
|
// CraftBukkit start
|
2024-01-19 13:22:30 +01:00
|
|
|
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
|
2022-04-18 11:51:45 +02:00
|
|
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
if (amount != event.getDamage() || event.isCancelled()) {
|