blob: 12c6d2b4a840fe9decd4e4b28c296db2a13ad710 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package at.hannibal2.skyhanni.config
import io.github.moulberry.moulconfig.gui.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
@Suppress("unused")
class ConfigGuiForgeInterop : IModGuiFactory {
override fun initialize(minecraft: Minecraft) {}
override fun mainConfigGuiClass(): Class<out GuiScreen> {
return WrappedSkyHanniConfig::class.java
}
override fun runtimeGuiCategories(): Set<RuntimeOptionCategoryElement>? = null
override fun getHandlerFor(runtimeOptionCategoryElement: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? =
null
class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.configEditor) {
@Throws(IOException::class)
override fun handleKeyboardInput() {
if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
Minecraft.getMinecraft().displayGuiScreen(parent)
return
}
super.handleKeyboardInput()
}
}
}
|