Search in sources :

Example 1 with MissingModsException

use of net.minecraftforge.fml.common.MissingModsException in project MinecraftForge by MinecraftForge.

the class FMLClientHandler method beginMinecraftLoading.

/**
     * Called to start the whole game off
     *
     * @param minecraft The minecraft instance being launched
     * @param resourcePackList The resource pack list we will populate with mods
     * @param resourceManager The resource manager
     */
@SuppressWarnings("unchecked")
public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resourcePackList, IReloadableResourceManager resourceManager, MetadataSerializer metaSerializer) {
    detectOptifine();
    SplashProgress.start();
    client = minecraft;
    this.resourcePackList = resourcePackList;
    this.metaSerializer = metaSerializer;
    this.resourcePackMap = Maps.newHashMap();
    if (minecraft.isDemo()) {
        FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
        haltGame("FML will not run in demo mode", new RuntimeException());
        return;
    }
    List<String> injectedModContainers = FMLCommonHandler.instance().beginLoading(this);
    try {
        Loader.instance().loadMods(injectedModContainers);
    } catch (WrongMinecraftVersionException wrong) {
        wrongMC = wrong;
    } catch (DuplicateModsFoundException dupes) {
        dupesFound = dupes;
    } catch (Java8VersionException j8mods) {
        j8onlymods = j8mods;
    } catch (MissingModsException missing) {
        modsMissing = missing;
    } catch (ModSortingException sorting) {
        modSorting = sorting;
    } catch (CustomModLoadingErrorDisplayException custom) {
        FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
        customError = custom;
    } catch (MultipleModsErrored multiple) {
        multipleModsErrored = multiple;
    } catch (LoaderException le) {
        haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
        return;
    } finally {
        client.refreshResources();
    }
    try {
        Loader.instance().preinitializeMods();
    } catch (CustomModLoadingErrorDisplayException custom) {
        FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
        customError = custom;
    } catch (LoaderException le) {
        haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
        return;
    }
    Map<String, Map<String, String>> sharedModList = (Map<String, Map<String, String>>) Launch.blackboard.get("modList");
    if (sharedModList == null) {
        sharedModList = Maps.newHashMap();
        Launch.blackboard.put("modList", sharedModList);
    }
    for (ModContainer mc : Loader.instance().getActiveModList()) {
        Map<String, String> sharedModDescriptor = mc.getSharedModDescriptor();
        if (sharedModDescriptor != null) {
            String sharedModId = "fml:" + mc.getModId();
            sharedModList.put(sharedModId, sharedModDescriptor);
        }
    }
}
Also used : MultipleModsErrored(net.minecraftforge.fml.common.MultipleModsErrored) Java8VersionException(net.minecraftforge.fml.common.Java8VersionException) ForgeModContainer(net.minecraftforge.common.ForgeModContainer) ModContainer(net.minecraftforge.fml.common.ModContainer) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) DuplicateModsFoundException(net.minecraftforge.fml.common.DuplicateModsFoundException) LoaderException(net.minecraftforge.fml.common.LoaderException) ModSortingException(net.minecraftforge.fml.common.toposort.ModSortingException) WrongMinecraftVersionException(net.minecraftforge.fml.common.WrongMinecraftVersionException) MissingModsException(net.minecraftforge.fml.common.MissingModsException) Map(java.util.Map) BiMap(com.google.common.collect.BiMap) ImmutableMap(com.google.common.collect.ImmutableMap) HashBiMap(com.google.common.collect.HashBiMap)

Example 2 with MissingModsException

use of net.minecraftforge.fml.common.MissingModsException in project BaseMetals by MinecraftModDevelopmentMods.

the class CommonProxy method preInit.

/**
 * @param event
 */
public void preInit(final FMLPreInitializationEvent event) {
    Config.init();
    if ((Options.requireMMDOreSpawn()) && (!Loader.isModLoaded(SharedStrings.ORESPAWN_MODID))) {
        if (Options.fallbackOrespawn()) {
            GameRegistry.registerWorldGenerator(new FallbackGenerator(), 0);
        } else {
            final HashSet<ArtifactVersion> orespawnMod = new HashSet<>();
            orespawnMod.add(new DefaultArtifactVersion(SharedStrings.ORESPAWN_VERSION));
            throw new MissingModsException(orespawnMod, SharedStrings.ORESPAWN_MODID, SharedStrings.ORESPAWN_MISSING_TEXT);
        }
    }
    com.mcmoddev.lib.init.Materials.init();
    Materials.init();
    Fluids.init();
    ItemGroups.init();
    com.mcmoddev.lib.init.Blocks.init();
    Blocks.init();
    com.mcmoddev.lib.init.Items.init();
    Items.init();
    // icons have to be setup after the blocks and items are initialized
    VillagerTrades.init();
    MinecraftForge.EVENT_BUS.register(new EventHandler());
    IntegrationManager.INSTANCE.preInit(event);
    IntegrationManager.INSTANCE.runCallbacks("preInit");
    allsGood = true;
}
Also used : FallbackGenerator(com.mcmoddev.lib.oregen.FallbackGenerator) ArtifactVersion(net.minecraftforge.fml.common.versioning.ArtifactVersion) DefaultArtifactVersion(net.minecraftforge.fml.common.versioning.DefaultArtifactVersion) DefaultArtifactVersion(net.minecraftforge.fml.common.versioning.DefaultArtifactVersion) EventHandler(com.mcmoddev.basemetals.util.EventHandler) MissingModsException(net.minecraftforge.fml.common.MissingModsException) HashSet(java.util.HashSet)

Example 3 with MissingModsException

use of net.minecraftforge.fml.common.MissingModsException in project MinecraftForge by MinecraftForge.

the class GuiMultipleModsErrored method initGui.

@Override
public void initGui() {
    super.initGui();
    int additionalSize = missingModsExceptions.isEmpty() || wrongMinecraftExceptions.isEmpty() ? 20 : 55;
    for (MissingModsException exception : missingModsExceptions) {
        additionalSize += exception.missingMods.size() * 10;
    }
    list = new GuiList(wrongMinecraftExceptions.size() * 10 + missingModsExceptions.size() * 15 + additionalSize);
}
Also used : MissingModsException(net.minecraftforge.fml.common.MissingModsException)

Aggregations

MissingModsException (net.minecraftforge.fml.common.MissingModsException)3 BiMap (com.google.common.collect.BiMap)1 HashBiMap (com.google.common.collect.HashBiMap)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 EventHandler (com.mcmoddev.basemetals.util.EventHandler)1 FallbackGenerator (com.mcmoddev.lib.oregen.FallbackGenerator)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ForgeModContainer (net.minecraftforge.common.ForgeModContainer)1 DummyModContainer (net.minecraftforge.fml.common.DummyModContainer)1 DuplicateModsFoundException (net.minecraftforge.fml.common.DuplicateModsFoundException)1 Java8VersionException (net.minecraftforge.fml.common.Java8VersionException)1 LoaderException (net.minecraftforge.fml.common.LoaderException)1 ModContainer (net.minecraftforge.fml.common.ModContainer)1 MultipleModsErrored (net.minecraftforge.fml.common.MultipleModsErrored)1 WrongMinecraftVersionException (net.minecraftforge.fml.common.WrongMinecraftVersionException)1 ModSortingException (net.minecraftforge.fml.common.toposort.ModSortingException)1 ArtifactVersion (net.minecraftforge.fml.common.versioning.ArtifactVersion)1 DefaultArtifactVersion (net.minecraftforge.fml.common.versioning.DefaultArtifactVersion)1