@Override public void mouseClick(GuiBase gui, int x, int y, int button) { if (!isActive()) { return; } for (int i = 0; i < list.size(); i++) { if (list.get(i) != null) { int[] rect = getItemButtonRect(i); if ((rect[3] > 0) && (inRect(gui, x, y, rect))) { if (selectedIndex == i) { selectedIndex = -1; } else { selectedIndex = i; } onClick(i); break; } } } int[] pos = {getScrollBar()[0], getScrollBar()[1], getScrollBar()[2], getScrollBar()[3]}; if ((list.size() >= maxItemDisplayed) && (inRect(gui, x, y, pos))) { y -= gui.getTop(); doScroll(y); isScrolling = true; } }
@Override public void mouseMoveClick(GuiBase gui, int x, int y, int button, long timeSinceClicked) { if (!isActive()) { return; } y -= gui.getTop(); if (isScrolling) { if (button == -1) { this.isScrolling = false; } else { doScroll(y); } } }