diff options
author | Shane Freeder <[email protected]> | 2024-06-23 14:04:58 +0100 |
---|---|---|
committer | Shane Freeder <[email protected]> | 2024-06-23 14:04:58 +0100 |
commit | 812701d901234f24575a20edd64940728c603ac5 (patch) | |
tree | f355f21875af76d23fdc49cbaadbbf9473e7eeda | |
parent | 76c2f16f577d2e5515482a8dcd3d97aeeec20e1e (diff) | |
download | Paper-812701d901234f24575a20edd64940728c603ac5.tar.gz Paper-812701d901234f24575a20edd64940728c603ac5.zip |
Do not crash when an exp orb attempts to mend an unrepairable item
-rw-r--r-- | patches/server/0823-Expand-PlayerItemMendEvent.patch | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/patches/server/0823-Expand-PlayerItemMendEvent.patch b/patches/server/0823-Expand-PlayerItemMendEvent.patch index 73068bdf5a..446aa3bb10 100644 --- a/patches/server/0823-Expand-PlayerItemMendEvent.patch +++ b/patches/server/0823-Expand-PlayerItemMendEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand PlayerItemMendEvent diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index a758b2456acac23095fe4619ae10300a034cb460..15844971ce2cca8c679ad3aaa2dfe160e6d0b564 100644 +index a758b2456acac23095fe4619ae10300a034cb460..a58ff67052fb5f33782f8b5c83465ec03ef1d073 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java @@ -354,7 +354,10 @@ public class ExperienceOrb extends Entity { @@ -14,7 +14,7 @@ index a758b2456acac23095fe4619ae10300a034cb460..15844971ce2cca8c679ad3aaa2dfe160 // CraftBukkit start - org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), k); + // Paper start - mending event -+ final int consumedExperience = k * amount / j; ++ final int consumedExperience = k > 0 ? k * amount / j : 0; + org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(player, this, itemstack, optional.get().inSlot(), k, consumedExperience); + // Paper end - mending event k = event.getRepairAmount(); |