aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-08 14:19:42 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-08 14:19:42 +0200
commit42ee590d1e82829872949e678e20ff6a9fd25456 (patch)
tree6d04f3bf7eb15d4bf58696485702b31a53e29c12 /src/main/java/cc/polyfrost/oneconfig/gui
parent2e97dce17a401b790799265523d72a3d168e2b7f (diff)
downloadOneConfig-42ee590d1e82829872949e678e20ff6a9fd25456.tar.gz
OneConfig-42ee590d1e82829872949e678e20ff6a9fd25456.tar.bz2
OneConfig-42ee590d1e82829872949e678e20ff6a9fd25456.zip
minimize
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java13
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java5
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 8897ec5..0b9362a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -41,16 +41,27 @@ public class OneConfigGui extends GuiScreen {
private ColorSelector currentColorSelector;
public boolean mouseDown;
private float scale = 1f;
+ public static OneConfigGui instanceToRestore = null;
public OneConfigGui() {
INSTANCE = this;
+ instanceToRestore = null;
}
public OneConfigGui(Page page) {
INSTANCE = this;
+ instanceToRestore = null;
currentPage = page;
}
+ public static OneConfigGui create() {
+ try {
+ return instanceToRestore == null ? new OneConfigGui() : instanceToRestore;
+ } finally {
+ instanceToRestore = null;
+ }
+ }
+
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
@@ -166,7 +177,7 @@ public class OneConfigGui extends GuiScreen {
try {
super.keyTyped(key, keyCode);
textInputField.keyTyped(key, keyCode);
- if(currentColorSelector != null) currentColorSelector.keyTyped(key, keyCode);
+ if (currentColorSelector != null) currentColorSelector.keyTyped(key, keyCode);
currentPage.keyTyped(key, keyCode);
} catch (Exception e) {
e.printStackTrace();
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index 4d506ba..978f420 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -30,7 +30,10 @@ public class SideBar {
btnList.add(new BasicButton(192, 36, "HUD Settings", Images.HUD_SETTINGS, null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Preferences", Images.PREFERENCES, null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Close", Images.CLOSE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> Minecraft.getMinecraft().displayGuiScreen(null)));
- btnList.add(new BasicButton(192, 36, "Minimize", Images.MINIMIZE, null, -1, BasicButton.ALIGNMENT_LEFT));
+ btnList.add(new BasicButton(192, 36, "Minimize", Images.MINIMIZE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> {
+ OneConfigGui.instanceToRestore = OneConfigGui.INSTANCE;
+ Minecraft.getMinecraft().displayGuiScreen(null);
+ }));
btnList.add(new BasicButton(192, 36, "Edit HUD", Images.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> Minecraft.getMinecraft().displayGuiScreen(new HudGui())));
}