Paper/patches/server/0533-Fix-PlayerItemConsumeEvent-cancelling-properly.patch
Jake Potrebic 526795bacd
Update patches to handle vineflower decompiler (#10406)
* Update patches to handle vineflower decompiler

* update patches again to handle inlined simple lambdas

* update vf again and re-apply/rebuild patches

* update patches after removal of verify-merges flag

* fix compile issue

* remove maven local

* fix some issues

* address more issues

* fix collision patch

* use paperweight release

* more fixes

* update fineflower and fix patches again

* add missing comment descriptor

---------

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2024-04-12 12:14:06 -07:00

23 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Fri, 19 Mar 2021 00:33:15 -0500
Subject: [PATCH] Fix PlayerItemConsumeEvent cancelling properly
When the active item is not cleared, the item is still readied
for use and will repeatedly trigger the PlayerItemConsumeEvent
till their item is switched.
This patch clears the active item when the event is cancelled
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d19a0733fe257eb66a02e263d4e053939f7ec978..687f379a811ba46cb3cddda33a62039b3b329cb3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3880,6 +3880,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
+ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use
// Update client
((ServerPlayer) this).getBukkitEntity().updateInventory();
((ServerPlayer) this).getBukkitEntity().updateScaledHealth();