protected void mousePressed ( UIComponent component , int button ) { try { long time = System . currentTimeMillis ( ) ; if ( component != null && component . isEnabled ( ) ) { boolean regularClick = true ; //double click if ( button == lastClickButton && time - lastClickTime < 250 && component == focusedComponent ) { regularClick = ! component . onDoubleClick ( MouseButton . getButton ( button ) ) ; lastClickTime = 0 ; } //do not trigger onButtonPress when double clicked (fixed shift-double click issue in inventory) if ( regularClick ) { component . onButtonPress ( MouseButton . getButton ( button ) ) ; if ( draggedComponent == null ) draggedComponent = component ; } component . setFocused ( true ) ; } else { setFocusedComponent ( null , true ) ; if ( inventoryContainer != null && ! inventoryContainer . getPickedItemStack ( ) . isEmpty ( ) ) { ActionType action = button == 1 ? ActionType . DROP_ONE : ActionType . DROP_STACK ; MalisisGui . sendAction ( action , null , button ) ; } } lastClickTime = time ; lastClickButton = button ; } catch ( Exception e ) { MalisisCore . message ( "A problem occured : " + e . getClass ( ) . getSimpleName ( ) + ": " + e . getMessage ( ) ) ; e . printStackTrace ( new PrintStream ( new FileOutputStream ( FileDescriptor . out ) ) ) ; } }
Called when a mouse button is pressed down .