InGamePacketHandler: drop transactions with 0 actions without trying to execute them

often we throw out actions that have no value, which can lead to an empty transaction and re-syncing the inventory. This happens every time we interact with the creative inventory in 1.13+, which causes items to appear to vanish when taking them from the creative menu.
The correct fix for this is to resend only the slots affected by SlotChangeActions, but this fix will suffice for now without rewriting everything.
This commit is contained in:
Dylan K. Taylor 2020-01-25 18:10:37 +00:00
parent 5955ff5393
commit e66197036d

View File

@ -260,6 +260,11 @@ class InGamePacketHandler extends PacketHandler{
return false;
}
if(count($actions) === 0){
//TODO: 1.13+ often sends transactions with nothing but useless crap in them, no need for the debug noise
return true;
}
$transaction = new InventoryTransaction($this->player, $actions);
try{
$transaction->execute();