onInitialize

open fun onInitialize()

This method will be run on the FMLLoadCompleteEvent on game startup after the config is loaded.

Override it in your implementation to perform additional initialization actions which require certain things like the config to be loaded. In the example below you can see this being used to register the module to run in the background if the corresponding setting is enabled.

Samples

import floppaclient.FloppaClient.Companion.mc
import floppaclient.module.Category
import floppaclient.module.Module
import floppaclient.module.RegisterHudElement
import floppaclient.module.settings.Visibility
import floppaclient.module.settings.impl.BooleanSetting
import floppaclient.module.settings.impl.NumberSetting
import floppaclient.ui.hud.HudElement
import floppaclient.utils.Utils.playLoudSound
import net.minecraft.util.StringUtils
import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import kotlin.math.ceil
fun main() { 
   //sampleStart 
   if(!this.enabled && trackInBackground.enabled) {
    MinecraftForge.EVENT_BUS.register(DungeonWarpTimer)
}
super.onInitialize() 
   //sampleEnd
}

See also