aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java')
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java
index f2352fb53d..fed1671484 100644
--- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java
+++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java
@@ -28,8 +28,11 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen {
// all slots not including btnCurrent
private final List<GT_GuiFakeItemButton> slots = new ArrayList<>();
// the currently selected slot content
- private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY)
- .setMimicSlot(true);
+ private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton(
+ this,
+ 8,
+ 25,
+ GT_GuiIcon.SLOT_DARKGRAY).setMimicSlot(true);
private final boolean noDeselect;
private int selected;
private int scroll = 0;
@@ -77,8 +80,8 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
slots.add(
- new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY)
- .setMimicSlot(true));
+ new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY).setMimicSlot(
+ true));
}
}
@@ -123,25 +126,29 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen {
public void mouseClicked(int x, int y, int button) {
int mx = x - guiLeft, my = y - guiTop;
if (button == 0) {
- if (btnCurrent.getBounds().contains(mx, my)) {
+ if (btnCurrent.getBounds()
+ .contains(mx, my)) {
ensureSelectedDisplayed();
return;
}
for (int i = 0, slotsSize = slots.size(); i < slotsSize; i++) {
GT_GuiFakeItemButton slot = slots.get(i);
- if (slot.getBounds().contains(mx, my)) {
+ if (slot.getBounds()
+ .contains(mx, my)) {
setSelected(slotIndexToListIndex(i));
return;
}
}
} else if (button == 1 && getSelected() >= 0) {
- if (btnCurrent.getBounds().contains(mx, my)) {
+ if (btnCurrent.getBounds()
+ .contains(mx, my)) {
setSelected(UNSELECTED);
return;
}
GT_GuiFakeItemButton slot = getSlot(listIndexToSlotIndex(getSelected()));
- if (slot != null && slot.getBounds().contains(mx, my)) {
+ if (slot != null && slot.getBounds()
+ .contains(mx, my)) {
setSelected(UNSELECTED);
}
}
@@ -156,8 +163,9 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen {
private void fillSlots() {
for (int i = 0, j = scroll * cols; i < slots.size(); i++, j++) {
- slots.get(i).setItem(getCandidate(j))
- .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY);
+ slots.get(i)
+ .setItem(getCandidate(j))
+ .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY);
}
}