GuiElement interface's mouseClick method returns a boolean which is handled by ComposedElement to prevent mouse clicks on multiple elements at once
ComposedElement's entries are sorted so that GuiDropdown are always drawn on top Modified thrown UnsupportedOperationExceptions in CustomImageObject to not be thrown if asset is null
This commit is contained in:
@@ -133,11 +133,10 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xPos, int yPos, int mouseButton) {
|
||||
mouseClickedResult(xPos, yPos);
|
||||
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||
return mouseClickedResult(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
public boolean mouseClickedResult(int xPos, int yPos) {
|
||||
boolean success = false;
|
||||
if(!isEnabled) return success;
|
||||
@@ -202,9 +201,18 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
||||
}
|
||||
|
||||
public void setSelectionIndex(int index) {
|
||||
setSelectionIndexQuietly(index);
|
||||
fireSelectionChangeEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection index without notifying SelectionChangeListeners.
|
||||
* @param index The Selection Index
|
||||
*/
|
||||
public void setSelectionIndexQuietly(int index) {
|
||||
this.selectionIndex = index;
|
||||
if(selectionIndex < 0) selectionIndex = -1;
|
||||
fireSelectionChangeEvent();
|
||||
if(selectionIndex >= elements.size()) selectionIndex = elements.size()-1;
|
||||
}
|
||||
|
||||
private void fireSelectionChangeEvent() {
|
||||
|
||||
Reference in New Issue
Block a user