aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGInterface.java3
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGModGuiFactory.java45
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java2
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java2
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java7
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/ConfigGuiScreenAdapter.java29
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java14
10 files changed, 101 insertions, 7 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGInterface.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGInterface.java
index 8da55e40..f1f44bb1 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGInterface.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGInterface.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.launcher;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.IResourceManager;
import java.io.File;
@@ -26,4 +27,6 @@ public interface DGInterface {
void init(File resourceDir);
void unload();
void onResourceReload(IResourceManager a);
+
+ Class<? extends GuiScreen> getModConfigGUI();
}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGModGuiFactory.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGModGuiFactory.java
new file mode 100644
index 00000000..0adfe96d
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/DGModGuiFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraftforge.fml.client.IModGuiFactory;
+
+import java.util.Set;
+
+public class DGModGuiFactory implements IModGuiFactory {
+ @Override
+ public void initialize(Minecraft minecraft) {}
+
+ @Override
+ public Class<? extends GuiScreen> mainConfigGuiClass() {
+ return Main.getMain().getCurrentLoader() == null ? null : Main.getMain().getCurrentLoader().getInstance().getModConfigGUI();
+ }
+
+ @Override
+ public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
+ return null;
+ }
+
+ @Override
+ public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement runtimeOptionCategoryElement) {
+ return null;
+ }
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java
index 2ad67688..520282fd 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LoaderMeta.java
@@ -19,5 +19,5 @@
package kr.syeyoung.dungeonsguide.launcher;
public class LoaderMeta {
- public static final int LOADER_VERSION = 1;
+ public static final int LOADER_VERSION = 2;
}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
index 36456dbc..56a87d60 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
@@ -58,7 +58,7 @@ import java.util.List;
import java.util.Objects;
import java.util.UUID;
-@Mod(modid = Main.MOD_ID, version = Main.VERSION)
+@Mod(modid = Main.MOD_ID, version = Main.VERSION, clientSideOnly = true, guiFactory = "kr.syeyoung.dungeonsguide.launcher.DGModGuiFactory")
public class Main
{
public static final String MOD_ID = "dungeons_guide_loader";
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index b0d67ab0..f3622b22 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -27,6 +27,7 @@ import kr.syeyoung.dungeonsguide.mod.commands.CommandDgDebug;
import kr.syeyoung.dungeonsguide.mod.commands.CommandDungeonsGuide;
import kr.syeyoung.dungeonsguide.mod.commands.CommandReparty;
import kr.syeyoung.dungeonsguide.mod.config.Config;
+import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ConfigGuiScreenAdapter;
import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager;
import kr.syeyoung.dungeonsguide.mod.cosmetics.CustomNetworkPlayerInfo;
import kr.syeyoung.dungeonsguide.mod.discord.DiscordIntegrationManager;
@@ -488,6 +489,8 @@ public class DungeonsGuide implements DGInterface {
}
-
-
+ @Override
+ public Class<? extends GuiScreen> getModConfigGUI() {
+ return ConfigGuiScreenAdapter.class;
+ }
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/ConfigGuiScreenAdapter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/ConfigGuiScreenAdapter.java
new file mode 100644
index 00000000..77717c74
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/ConfigGuiScreenAdapter.java
@@ -0,0 +1,29 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3;
+
+import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale;
+import net.minecraft.client.gui.GuiScreen;
+
+public class ConfigGuiScreenAdapter extends GuiScreenAdapter {
+ public ConfigGuiScreenAdapter(GuiScreen parent) {
+ super(new GlobalHUDScale(new MainConfigWidget()), parent);
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java
index 525d5e97..c082eb2a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java
@@ -93,7 +93,7 @@ public class FeatureItem extends AnnotatedImportOnlyWidget {
@On(functionName = "relocate")
public void onRelocate() {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
- Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig((AbstractHUDFeature) feature))));
+ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig((AbstractHUDFeature) feature)), Minecraft.getMinecraft().currentScreen));
// do stuff
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java
index 0f3d9cda..da65f8c6 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java
@@ -52,6 +52,6 @@ public class GUIOpenItem extends AnnotatedImportOnlyWidget {
@On(functionName = "click")
public void openPage() {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
- Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(pageCreator.get())));
+ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(pageCreator.get()), Minecraft.getMinecraft().currentScreen));
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
index b5b1fafb..94bec8fd 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
@@ -181,7 +181,7 @@ public abstract class AbstractHUDFeature extends AbstractGuiFeature {
public void configure() {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
MainConfigWidget mainConfigWidget = new MainConfigWidget();
- GuiScreenAdapter adapter = new GuiScreenAdapter(new GlobalHUDScale(mainConfigWidget));
+ GuiScreenAdapter adapter = new GuiScreenAdapter(new GlobalHUDScale(mainConfigWidget), Minecraft.getMinecraft().currentScreen);
Minecraft.getMinecraft().displayGuiScreen(adapter);
Navigator.getNavigator(mainConfigWidget.getDomElement()).openPage(
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
index 6bcad794..34d755cb 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
@@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor;
import kr.syeyoung.dungeonsguide.mod.utils.cursor.GLCursors;
import lombok.Getter;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -47,7 +48,12 @@ public class GuiScreenAdapter extends GuiScreen {
private Stack<RootDom> domStack = new Stack<>();
+ private GuiScreen parent;
public GuiScreenAdapter(Widget widget) {
+ this(widget, null);
+ }
+ public GuiScreenAdapter(Widget widget, GuiScreen parent) {
+ this.parent = parent;
view = new RootDom(widget);
view.getContext().CONTEXT.put("screenAdapter", this);
@@ -134,6 +140,14 @@ public class GuiScreenAdapter extends GuiScreen {
@Override
public void keyTyped(char typedChar, int keyCode) throws IOException {
+ if (keyCode == 1) {
+ this.mc.displayGuiScreen((GuiScreen)parent);
+ if (this.mc.currentScreen == null) {
+ this.mc.setIngameFocus();
+ }
+ return;
+ }
+
try {
view.keyPressed0(typedChar, keyCode);
super.keyTyped(typedChar, keyCode);