diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-08 19:01:24 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-08 19:01:24 +0200 |
commit | 5588d2ec85891cd6cee669a81514b39dd3711767 (patch) | |
tree | 9657a1a71000c4a2d0b4b3360e6491f22c402617 /src/main/java/at/hannibal2/skyhanni | |
parent | 9810ab4209ba14bca41fa0d7e7c9753e35093d00 (diff) | |
download | skyhanni-5588d2ec85891cd6cee669a81514b39dd3711767.tar.gz skyhanni-5588d2ec85891cd6cee669a81514b39dd3711767.tar.bz2 skyhanni-5588d2ec85891cd6cee669a81514b39dd3711767.zip |
changed interop to kotlin
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-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 |