protected override void HandleMouseClick(Slot par1Slot, int par2, int par3, bool par4) { if (par1Slot != null) { if (par1Slot.Inventory == Inventory) { InventoryPlayer inventoryplayer = Mc.ThePlayer.Inventory; ItemStack itemstack1 = inventoryplayer.GetItemStack(); ItemStack itemstack4 = par1Slot.GetStack(); if (itemstack1 != null && itemstack4 != null && itemstack1.ItemID == itemstack4.ItemID) { if (par3 == 0) { if (par4) { itemstack1.StackSize = itemstack1.GetMaxStackSize(); } else if (itemstack1.StackSize < itemstack1.GetMaxStackSize()) { itemstack1.StackSize++; } } else if (itemstack1.StackSize <= 1) { inventoryplayer.SetItemStack(null); } else { itemstack1.StackSize--; } } else if (itemstack1 != null) { inventoryplayer.SetItemStack(null); } else if (itemstack4 == null) { inventoryplayer.SetItemStack(null); } else if (itemstack1 == null || itemstack1.ItemID != itemstack4.ItemID) { inventoryplayer.SetItemStack(ItemStack.CopyItemStack(itemstack4)); ItemStack itemstack2 = inventoryplayer.GetItemStack(); if (par4) { itemstack2.StackSize = itemstack2.GetMaxStackSize(); } } } else { InventorySlots.SlotClick(par1Slot.SlotNumber, par3, par4, Mc.ThePlayer); ItemStack itemstack = InventorySlots.GetSlot(par1Slot.SlotNumber).GetStack(); Mc.PlayerController.SendSlotPacket(itemstack, (par1Slot.SlotNumber - InventorySlots.InventorySlots.Count) + 9 + 36); } } else { InventoryPlayer inventoryplayer1 = Mc.ThePlayer.Inventory; if (inventoryplayer1.GetItemStack() != null) { if (par3 == 0) { Mc.ThePlayer.DropPlayerItem(inventoryplayer1.GetItemStack()); Mc.PlayerController.Func_35639_a(inventoryplayer1.GetItemStack()); inventoryplayer1.SetItemStack(null); } if (par3 == 1) { ItemStack itemstack3 = inventoryplayer1.GetItemStack().SplitStack(1); Mc.ThePlayer.DropPlayerItem(itemstack3); Mc.PlayerController.Func_35639_a(itemstack3); if (inventoryplayer1.GetItemStack().StackSize == 0) { inventoryplayer1.SetItemStack(null); } } } } }