Search in sources :

Example 1 with DLPreInitEvent

use of io.discloader.discloader.common.event.DLPreInitEvent in project DiscLoader by R3alCl0ud.

the class ModRegistry method loadMod.

public static void loadMod(String modid) {
    ModContainer mod = preInitMods.get(modid);
    ProgressLogger.progress(1, 3, "Checking if another mod is currently active");
    logger.info("Checking if another mod is currently active");
    if (activeMod != null) {
        loadMod.put(mod.modInfo.modid(), activeMod.modInfo.modid());
    }
    ProgressLogger.progress(2, 3, "Setting active mod");
    logger.info("Setting active mod");
    activeMod = mod;
    ProgressLogger.progress(3, 3, "Executing PreInit handler in: " + mod.modInfo.modid());
    logger.info("Executing PreInit handler in: " + mod.modInfo.modid());
    mods.put(mod.modInfo.modid(), mod);
    DLPreInitEvent event = new DLPreInitEvent(loader);
    mod.emit("preInit", event);
    if (loadMod.containsKey(mod.modInfo.modid())) {
        activeMod = preInitMods.get(loadMod.get(mod.modInfo.modid()));
    } else {
        activeMod = null;
    }
    mod.loaded = true;
}
Also used : DLPreInitEvent(io.discloader.discloader.common.event.DLPreInitEvent) ModContainer(io.discloader.discloader.common.discovery.ModContainer)

Aggregations

ModContainer (io.discloader.discloader.common.discovery.ModContainer)1 DLPreInitEvent (io.discloader.discloader.common.event.DLPreInitEvent)1