Use forge events in forgeInit.kt, and add a @JvmStatic annotation to the logger in Snowy.kt
This commit is contained in:
parent
3b55558ca4
commit
6bb1e6eac8
|
@ -5,6 +5,7 @@ import org.apache.logging.log4j.Logger
|
|||
|
||||
abstract class Snowy {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val logs: Logger = LogManager.getLogger("Snowy")
|
||||
}
|
||||
fun atInit() {
|
||||
|
|
|
@ -5,13 +5,16 @@ import fr.username404.snowygui.config.SnowyConfigScreen
|
|||
import net.minecraftforge.fml.ExtensionPoint
|
||||
import net.minecraftforge.fml.ModLoadingContext
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
|
||||
import java.util.function.BiFunction
|
||||
import java.util.function.Supplier
|
||||
|
||||
@Mod("snowygui")
|
||||
class ForgeInit: Snowy() {
|
||||
init {
|
||||
atInit()
|
||||
private fun initSetup(event: FMLCommonSetupEvent) = atInit()
|
||||
private fun configSetup(event: FMLClientSetupEvent) {
|
||||
ModLoadingContext.get().registerExtensionPoint(
|
||||
ExtensionPoint.CONFIGGUIFACTORY,
|
||||
Supplier {
|
||||
|
@ -23,4 +26,10 @@ class ForgeInit: Snowy() {
|
|||
}
|
||||
)
|
||||
}
|
||||
init {
|
||||
with(FMLJavaModLoadingContext.get().modEventBus) {
|
||||
addListener(this@ForgeInit::initSetup)
|
||||
addListener(this@ForgeInit::configSetup)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue