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
|
|
|
|
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
|
2023-01-27 21:52:04 +01:00
|
|
|
index def4d9c5a9b311d002eb88729bdba73b30f99bb7..6860096cb8c0deecc9c1d87543d1128fb95fd2d4 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
|
2023-01-27 21:52:04 +01:00
|
|
|
@@ -572,10 +572,11 @@ public final class ItemStack {
|
2022-04-18 11:51:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ 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()) {
|