Class ModLoader

    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • INSTANCE

        private static ModLoader INSTANCE
      • launchClassLoader

        private final cpw.mods.modlauncher.TransformingClassLoader launchClassLoader
      • loadingStateValid

        private boolean loadingStateValid
      • statusConsumer

        private final java.util.Optional<java.util.function.Consumer<java.lang.String>> statusConsumer
      • runningDataGen

        private static boolean runningDataGen
    • Constructor Detail

      • ModLoader

        private ModLoader()
    • Method Detail

      • computeLanguageList

        private java.lang.String computeLanguageList()
      • computeModLauncherServiceList

        private java.lang.String computeModLauncherServiceList()
      • gatherAndInitializeMods

        public void gatherAndInitializeMods​(ModWorkManager.DrivenExecutor syncExecutor,
                                            java.util.concurrent.Executor parallelExecutor,
                                            java.lang.Runnable periodicTask)
        Run on the primary starting thread by ClientModLoader and ServerModLoader
        Parameters:
        syncExecutor - An executor to run tasks on the main thread
        parallelExecutor - An executor to run tasks on a parallel loading thread pool
        periodicTask - Optional periodic task to perform on the main thread while other activities run
      • loadMods

        public void loadMods​(ModWorkManager.DrivenExecutor syncExecutor,
                             java.util.concurrent.Executor parallelExecutor,
                             java.util.function.Function<java.util.concurrent.Executor,​java.util.concurrent.CompletableFuture<java.lang.Void>> beforeSidedEvent,
                             java.util.function.Function<java.util.concurrent.Executor,​java.util.concurrent.CompletableFuture<java.lang.Void>> afterSidedEvent,
                             java.lang.Runnable periodicTask)
      • finishMods

        public void finishMods​(ModWorkManager.DrivenExecutor syncExecutor,
                               java.util.concurrent.Executor parallelExecutor,
                               java.lang.Runnable periodicTask)
      • dispatchAndHandleError

        private void dispatchAndHandleError​(ModLoadingStage state,
                                            ModWorkManager.DrivenExecutor syncExecutor,
                                            java.util.concurrent.Executor parallelExecutor,
                                            java.lang.Runnable ticker,
                                            java.util.function.Function<java.util.concurrent.Executor,​java.util.concurrent.CompletableFuture<java.lang.Void>> preSyncTask,
                                            java.util.function.Function<java.util.concurrent.Executor,​java.util.concurrent.CompletableFuture<java.lang.Void>> postSyncTask)
      • waitForTransition

        private void waitForTransition​(ModLoadingStage state,
                                       ModWorkManager.DrivenExecutor syncExecutor,
                                       java.lang.Runnable ticker,
                                       java.util.concurrent.CompletableFuture<java.util.List<java.lang.Throwable>> transition)
      • buildMods

        private java.util.List<ModContainer> buildMods​(ModFile modFile,
                                                       cpw.mods.modlauncher.TransformingClassLoader modClassLoader)
      • buildModContainerFromTOML

        private ModContainer buildModContainerFromTOML​(ModFile modFile,
                                                       cpw.mods.modlauncher.TransformingClassLoader modClassLoader,
                                                       java.util.Map<java.lang.String,​net.minecraftforge.forgespi.language.IModInfo> modInfoMap,
                                                       java.util.Map.Entry<java.lang.String,​? extends net.minecraftforge.forgespi.language.IModLanguageProvider.IModLanguageLoader> idToProviderEntry)
      • isLoadingStateValid

        public static boolean isLoadingStateValid()
        Returns:
        If the current mod loading state is valid. Use if you interact with vanilla systems directly during loading and don't want to cause extraneous crashes due to trying to do things that aren't possible in a "broken load"
      • runEventGenerator

        public <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> void runEventGenerator​(java.util.function.Function<ModContainer,​T> generator)
      • postEvent

        public <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> void postEvent​(T e)
      • isDataGenRunning

        public static boolean isDataGenRunning()