mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix bug: drop single item cause exception
This commit is contained in:
parent
f0af851df8
commit
cbe348555b
1 changed files with 6 additions and 1 deletions
|
|
@ -1537,12 +1537,17 @@ namespace MinecraftClient
|
||||||
break;
|
break;
|
||||||
case WindowActionType.DropItem:
|
case WindowActionType.DropItem:
|
||||||
if (inventory.Items.ContainsKey(slotId))
|
if (inventory.Items.ContainsKey(slotId))
|
||||||
|
{
|
||||||
inventory.Items[slotId].Count--;
|
inventory.Items[slotId].Count--;
|
||||||
|
changedSlots.Add(new Tuple<short, Item>((short)slotId, inventory.Items[slotId]));
|
||||||
|
}
|
||||||
|
|
||||||
if (inventory.Items[slotId].Count <= 0)
|
if (inventory.Items[slotId].Count <= 0)
|
||||||
|
{
|
||||||
inventory.Items.Remove(slotId);
|
inventory.Items.Remove(slotId);
|
||||||
|
changedSlots.Add(new Tuple<short, Item>((short)slotId, null));
|
||||||
|
}
|
||||||
|
|
||||||
changedSlots.Add(new Tuple<short, Item>((short)slotId, inventory.Items[slotId]));
|
|
||||||
break;
|
break;
|
||||||
case WindowActionType.DropItemStack:
|
case WindowActionType.DropItemStack:
|
||||||
inventory.Items.Remove(slotId);
|
inventory.Items.Remove(slotId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue