From 6f6ce67dc5a32488a5c7f80a540a3a841c7fcadb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 4 Oct 2022 18:26:58 +0200 Subject: updated to 0.12.2 and made forge mod list button work --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 4 +- .../skyhanni/config/ConfigGuiForgeInterop.java | 49 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.java (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 57e23487f..47122a9dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -57,11 +57,11 @@ import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; -@Mod(modid = SkyHanniMod.MODID, version = SkyHanniMod.VERSION) +@Mod(modid = SkyHanniMod.MODID, version = SkyHanniMod.VERSION, clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop") public class SkyHanniMod { public static final String MODID = "skyhanni"; - public static final String VERSION = "0.12.1"; + public static final String VERSION = "0.12.2"; public static Features feature; diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.java b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.java new file mode 100644 index 000000000..0633f09de --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.java @@ -0,0 +1,49 @@ +package at.hannibal2.skyhanni.config; + +import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.fml.client.IModGuiFactory; +import org.lwjgl.input.Keyboard; + +import java.io.IOException; +import java.util.Set; + +public class ConfigGuiForgeInterop implements IModGuiFactory { + @Override + public void initialize(Minecraft minecraft) {} + + @Override + public Class mainConfigGuiClass() { + return WrappedSkyHanniConfig.class; + } + + @Override + public Set runtimeGuiCategories() { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement runtimeOptionCategoryElement) { + return null; + } + + public static class WrappedSkyHanniConfig extends GuiScreenElementWrapper { + + private final GuiScreen parent; + + public WrappedSkyHanniConfig(GuiScreen parent) { + super(ConfigEditor.editor); + this.parent = parent; + } + + @Override + public void handleKeyboardInput() throws IOException { + if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { + Minecraft.getMinecraft().displayGuiScreen(parent); + return; + } + super.handleKeyboardInput(); + } + } +} -- cgit