From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: chickeneer Date: Thu, 22 Apr 2021 19:02:07 -0700 Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java index 68026536cfc26f07ca99ee9e76fd74b4ed4a995c..848fb02988b0fb319655f790112274ac2a437d25 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java @@ -24,6 +24,7 @@ public class ServerboundSetCarriedItemPacket implements Packet= 0 && packet.getSlot() < Inventory.getSelectionSize()) { + if (packet.getItemInHandIndex() == this.player.inventory.selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.selected, packet.getSlot()); this.craftServer.getPluginManager().callEvent(event); if (event.isCancelled()) {