blob: 3f2d398368d61c6c24f5241dcd81769510cbb615 (
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
35
|
package at.hannibal2.skyhanni.config
import io.github.notenoughupdates.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 {
@Suppress("EmptyFunctionBlock")
override fun initialize(minecraft: Minecraft) {}
override fun mainConfigGuiClass() = WrappedSkyHanniConfig::class.java
override fun runtimeGuiCategories(): Set<RuntimeOptionCategoryElement>? = null
override fun getHandlerFor(element: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? = null
class WrappedSkyHanniConfig(private val parent: GuiScreen) :
GuiScreenElementWrapper(ConfigGuiManager.getEditorInstance()) {
@Throws(IOException::class)
override fun handleKeyboardInput() {
if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
Minecraft.getMinecraft().displayGuiScreen(parent)
return
}
super.handleKeyboardInput()
}
}
}
|