aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java13
1 files changed, 12 insertions, 1 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();