Preloading Tricks Wiki › Guides › Use Early Loader Hooks in Your Mod Code
Use Early Loader Hooks in Your Mod Code
Understand Available Hooks
Preloading Tricks provides early callbacks that execute before mod initialization completes. Key hooks include onSetupLanguageAdapter and onSetupMods, which fire during critical loader setup phases.
Register Your Hook
In your mod's setup code, register a callback that listens for one of these early events. Your callback will be invoked as soon as the loader reaches that phase, before normal mod loading continues.
Modify Loader Behavior
Use your hook to:
- Tweak how the loader handles language adapters
- Inspect or modify the mod list before processing
- Prepare special data structures needed by your mod
- Intervene in loader configuration before the game environment is fully prepared
Since these hooks run exceptionally early, they're ideal for foundational changes that affect how other mods load or how the loader itself behaves. This is more powerful than standard initialization events because you're working before the mod loader has finished its own setup.