public virtual void SlotsInteraction(int slotFrom, int slotTo) { if (slotFrom == slotTo) { return; } ItemStack stackFrom = GetItemStack(slotFrom); ItemStack stackTo = GetItemStack(slotTo); if (!IsValidForSet(slotTo, stackFrom)) { return; } if (IsEmpty(slotTo)) { SetItemStack(slotTo, stackFrom); RemoveItemStack(slotFrom); } else if (CanSwap(stackFrom, stackTo)) { SwapItemStacks(slotFrom, slotTo); } else if (stackFrom.EqualsWithoutSize(stackTo)) { int maxSize = ItemManager.FindItemInfo(stackFrom.ItemName).MaxStackSize; int residue = stackFrom.StackSize + stackTo.StackSize - maxSize; if (residue > 0) { SetStackCount(slotFrom, residue); SetStackCount(slotTo, maxSize); } else { RemoveItemStack(slotFrom); SetItemStack(slotTo, new ItemStack(stackFrom.ItemName, stackFrom.StackSize + stackTo.StackSize)); } } if (!isServer) { CmdSlotsInteraction(slotFrom, slotTo); } }