From 901449b0b16bd1d65e87304c4ea915d19bef6044 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 23 Mar 2022 13:47:01 +0000 Subject: [PATCH] Player: simplify PlayerItemHeldEvent calling on content change the second parameter to this callback is the OLD slots, not the changed slots. This means that ALL slots are included, including empty and unchanged slots. --- src/player/Player.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/player/Player.php b/src/player/Player.php index da0b03b47..e27b72500 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -335,12 +335,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->callDummyItemHeldEvent(); } }, - function(Inventory $unused, array $changedSlots) : void{ + function() : void{ $this->setUsingItem(false); - $heldSlot = $this->inventory->getHeldItemIndex(); - if(isset($changedSlots[$heldSlot])){ - $this->callDummyItemHeldEvent(); - } + $this->callDummyItemHeldEvent(); } ));