Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Preloading Tricks Wiki › Guides › Intervene in Mod Loader Setup Before Initialization

Intervene in Mod Loader Setup Before Initialization

Understand the Preloading Phase

Preloading Tricks lets you hook into the mod loader's setup process before it officially initializes mods. This phase is ideal for global configuration changes or environment preparation that must happen before any mod code runs.

Register an Early Callback

Set up a callback that responds to loader events like onSetupLanguageAdapter or onSetupMods. Your code will execute during the loader's internal setup, not during standard mod initialization.

Perform Setup Tasks

Use your early callback to:

  • Modify how language adapters are configured
  • Adjust the mod discovery or loading order
  • Inject data or configuration the loader needs
  • Prepare the environment for mods that depend on special conditions

Verify Execution Order

Because these hooks run so early, they execute before mod constructors, @Mod.EventHandler methods, and common setup events. This makes them powerful for foundational changes but requires careful coordination if multiple mods use preloading tricks.