GuiSoundSelection 1.12

Backports GuiSoundSelection from 1.12
- customScrollDoubleClicked (to be renamed)
- Better GUI Selection Handling
This commit is contained in:
Kam committed 2024-03-12 01:58:35 -04:00
1 parent 0f343b66a9
commit 3dc60ec1a7
7 files changed
+785 -21

No files matched your search

@@ -36,6 +36,9 @@ public class GuiCustomScroll extends GuiScreen
public boolean visible = true;
private boolean selectable = true;
private int lastClickedItem;
private long lastClickedTime = 0;
public GuiCustomScroll(GuiScreen parent, int id)
{
width = 176;
@@ -274,8 +277,16 @@ public class GuiCustomScroll extends GuiScreen
selected = hover;
hover = -1;
}
if(listener != null)
listener.customScrollClicked(i, j, k,this);
if(listener != null) {
long time = System.currentTimeMillis();
listener.customScrollClicked(i, j, k, this);
if(selected >= 0 && selected == lastClickedItem && time - lastClickedTime < 500) {
listener.customScrollDoubleClicked(list.get(selected), this);
}
lastClickedTime = time;
lastClickedItem = selected;
}
}
private void drawScrollBar()