Fix the configuration screen registration in ForgeInit.kt

This commit is contained in:
Username404 2021-08-06 14:19:47 +02:00
parent b34b49c27d
commit bb9e9b382b
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 4 deletions

View File

@ -4,16 +4,15 @@ import fr.username404.snowygui.Snowy
import fr.username404.snowygui.config.SnowyConfigScreen
import fr.username404.snowygui.config.configScreenParent
import fr.username404.snowygui.gui.feature.ButtonImpl
import net.minecraftforge.fml.ExtensionPoint
import net.minecraftforge.fml.ModList
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import net.minecraftforge.fmlclient.ConfigGuiHandler
import net.minecraftforge.forgespi.language.ModFileScanData
import org.objectweb.asm.Type
import thedarkcolour.kotlinforforge.forge.FORGE_BUS
import thedarkcolour.kotlinforforge.forge.LOADING_CONTEXT
import thedarkcolour.kotlinforforge.forge.MOD_BUS
import java.util.function.BiFunction
@Mod("snowygui")
@Suppress("UNUSED_PARAMETER")
@ -21,8 +20,8 @@ class ForgeInit: Snowy() {
private fun initSetup(event: FMLClientSetupEvent) = atInit()
private fun configSetup(event: FMLClientSetupEvent) {
LOADING_CONTEXT.registerExtensionPoint(
ExtensionPoint.CONFIGGUIFACTORY
) { BiFunction { _, parent -> configScreenParent = parent; SnowyConfigScreen } }
ConfigGuiHandler.ConfigGuiFactory::class.java
) { ConfigGuiHandler.ConfigGuiFactory { _, parent -> configScreenParent = parent; SnowyConfigScreen } }
}
override val annotatedButtons = ModList.get() // Forge-specific reflection
.allScanData