mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
5960af9d87
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 7da4c0be SPIGOT-6729: Add Chunk.isEntitiesLoaded() CraftBukkit Changes: 9217b523 #929: Call EntityBlockFormEvent for Wither Rose placed by dead entity 757d42ae SPIGOT-6729: Add Chunk.isEntitiesLoaded()
22 lines
1.3 KiB
Diff
22 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 6c6c4922e922f5475086752382350a6a2ad9ab6f..702b166e032f1aedc8e1faa1e04738e768b40aa9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3703,6 +3703,7 @@ public abstract class LivingEntity extends Entity {
|
|
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();
|