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.
This commit is contained in:
Dylan K. Taylor 2022-03-23 13:47:01 +00:00
parent 4e777572c9
commit 901449b0b1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -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();
}
));