File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/main/kotlin/com/github/itsempa/nautilus Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import java.io.File
3838 clientSideOnly = true ,
3939 version = Nautilus .VERSION ,
4040 modLanguageAdapter = " com.github.itsempa.nautilus.utils.KotlinLanguageAdapter" ,
41+ guiFactory = " com.github.itsempa.nautilus.config.core.ConfigGuiForgeInterop" ,
4142 dependencies = " after:skyhanni" ,
4243)
4344object Nautilus {
Original file line number Diff line number Diff line change 1+ package com.github.itsempa.nautilus.config.core
2+
3+ import at.hannibal2.skyhanni.deps.moulconfig.gui.GuiScreenElementWrapper
4+ import com.github.itsempa.nautilus.utils.helpers.McScreen
5+ import net.minecraft.client.Minecraft
6+ import net.minecraft.client.gui.GuiScreen
7+ import net.minecraftforge.fml.client.IModGuiFactory
8+ import org.lwjgl.input.Keyboard
9+ import java.io.IOException
10+
11+ @Suppress(" unused" )
12+ class ConfigGuiForgeInterop : IModGuiFactory {
13+ override fun initialize (minecraft : Minecraft ) { /* Empty */ }
14+
15+ override fun mainConfigGuiClass () = WrappedNautilusConfig ::class .java
16+
17+ override fun runtimeGuiCategories (): Set <IModGuiFactory .RuntimeOptionCategoryElement >? = null
18+
19+ override fun getHandlerFor (element : IModGuiFactory .RuntimeOptionCategoryElement ) = null
20+
21+ class WrappedNautilusConfig (
22+ private val parent : GuiScreen
23+ ) : GuiScreenElementWrapper(ConfigManager .editor) {
24+
25+ @Throws(IOException ::class )
26+ override fun handleKeyboardInput () {
27+ if (Keyboard .getEventKeyState() && Keyboard .getEventKey() == Keyboard .KEY_ESCAPE ) {
28+ return McScreen .display(parent)
29+ } else super .handleKeyboardInput()
30+ }
31+
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments