diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt | 66 |
1 files changed, 25 insertions, 41 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt index 0633f09de..db63c0168 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt @@ -1,49 +1,33 @@ -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; +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 net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement +import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler +import org.lwjgl.input.Keyboard +import java.io.IOException + +class ConfigGuiForgeInterop : IModGuiFactory { + override fun initialize(minecraft: Minecraft) {} + override fun mainConfigGuiClass(): Class<out GuiScreen> { + return WrappedSkyHanniConfig::class.java } - public static class WrappedSkyHanniConfig extends GuiScreenElementWrapper { + override fun runtimeGuiCategories(): Set<RuntimeOptionCategoryElement>? = null - private final GuiScreen parent; - - public WrappedSkyHanniConfig(GuiScreen parent) { - super(ConfigEditor.editor); - this.parent = parent; - } + override fun getHandlerFor(runtimeOptionCategoryElement: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? = + null - @Override - public void handleKeyboardInput() throws IOException { + class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigEditor.editor) { + @Throws(IOException::class) + override fun handleKeyboardInput() { if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { - Minecraft.getMinecraft().displayGuiScreen(parent); - return; + Minecraft.getMinecraft().displayGuiScreen(parent) + return } - super.handleKeyboardInput(); + super.handleKeyboardInput() } } -} +}
\ No newline at end of file |