Add drop item for inventory

This commit is contained in:
ReinforceZwei 2020-05-24 15:06:06 +08:00 committed by ORelio
parent 902527502e
commit aaf6dca522
3 changed files with 33 additions and 6 deletions

View file

@ -1366,8 +1366,16 @@ namespace MinecraftClient.Protocol.Handlers
button = 0;
mode = 4;
item = new Item(-1, 0, null);
Container inventory = handler.GetInventory(0);
inventory.Items[slotId].Count--; // server won't update us after dropped
Container inventory = handler.GetInventory(windowId);
if (inventory.Items.ContainsKey(slotId))
inventory.Items[slotId].Count--; // server won't update us after dropped
break;
case WindowActionType.DropItemStack:
button = 1;
mode = 4;
item = new Item(-1, 0, null);
inventory = handler.GetInventory(windowId);
inventory.Items.Remove(slotId); // server won't update us after dropped
break;
}