From 5588d2ec85891cd6cee669a81514b39dd3711767 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 8 Oct 2022 19:01:24 +0200 Subject: changed interop to kotlin --- .../skyhanni/config/ConfigGuiForgeInterop.kt | 66 ++++++++-------------- 1 file changed, 25 insertions(+), 41 deletions(-) (limited to 'src/main') 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 mainConfigGuiClass() { - return WrappedSkyHanniConfig.class; - } - - @Override - public Set 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 { + return WrappedSkyHanniConfig::class.java } - public static class WrappedSkyHanniConfig extends GuiScreenElementWrapper { + override fun runtimeGuiCategories(): Set? = 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 -- cgit