diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.java | 49 |
2 files changed, 51 insertions, 2 deletions
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<? extends GuiScreen> mainConfigGuiClass() { + return WrappedSkyHanniConfig.class; + } + + @Override + public Set<RuntimeOptionCategoryElement> 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(); + } + } +} |