onEnable

open fun onEnable()

This method is run whenever the module is enabled.

Its default implementation registers the module to the Forge EventBus.

Override it in your implementation to perform extra actions when the module is activated. Keep in mind that you still have to invoke this implementation to register the module to the event bus.

The following example shows how you can use this to prevent a module from being enabled in certain conditions and to run some extra code.

Samples

import floppaclient.FloppaClient.Companion.mc
import floppaclient.events.PacketSentEvent
import floppaclient.module.Category
import floppaclient.module.Module
import floppaclient.module.settings.Setting.Companion.withDependency
import floppaclient.module.settings.Setting.Companion.withInputTransform
import floppaclient.module.settings.impl.BooleanSetting
import floppaclient.module.settings.impl.NumberSetting
import floppaclient.module.settings.impl.StringSelectorSetting
import floppaclient.utils.ChatUtils
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
import net.minecraft.network.play.client.C03PacketPlayer
import net.minecraft.util.MathHelper
import net.minecraft.world.World
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
fun main() { 
   //sampleStart 
   if(mc.thePlayer == null || mc.theWorld == null) {
    toggle()
    return
}
super.onEnable()
when(mode.selected) {
    "True Free Cam" -> setupViewEntity()
    "Ping Spoof" -> clonePlayer()
} 
   //sampleEnd
}