Class ForgeCoreLoader

java.lang.Object
mods.thecomputerizer.theimpossiblelibrary.forge.core.ForgeCoreLoader

public class ForgeCoreLoader extends Object
Figures out which version to load on and how to load stuff on it
  • Constructor Details

    • ForgeCoreLoader

      public ForgeCoreLoader()
  • Method Details

    • bootLoader

      public static ClassLoader bootLoader()
      Should be the ClassLoader for the BOOT layer or the system ClassLoader if Java 8
    • exportAllModules

      public static void exportAllModules() throws Throwable
      Export the given module to all packages loaded to a module in the GAME layer
      Throws:
      Throwable
    • findModuleLoaderForPackage

      public static Object[] findModuleLoaderForPackage(String pkg, ClassLoader[] loaders, boolean newFormat)
      Returns an array where the elements are the ClassLoader, resolved module, and the name of the layer. Assumes the given loaders array will always be in the order of BOOT, SERVICE, PLUGIN, GAME
    • fixFirstEntryPoint

      public static void fixFirstEntryPoint()
      Sets up some important stuff needed to initialize the loading process.
    • getBootLoadedCoreAPI

      @Nullable public static Object getBootLoadedCoreAPI()
    • getModuleFromPackage

      public static Object getModuleFromPackage(String pkg, String layerName, boolean newFormat)
    • isJava8

      public static boolean isJava8()
    • layerClassLoader

      public static ClassLoader layerClassLoader(String name)
      Tries to get the ClassLoader instance associated with the given layer name
    • moduleName

      public static String moduleName(Object module)
    • moveModuleToLayer

      public static void moveModuleToLayer(ClassLoader targetLoader, String layerTo, String layerFrom, String moduleName)
    • nukeAndFinalize

      public static void nukeAndFinalize(net.minecraftforge.forgespi.language.IModInfo mod, String pkg, Set<String> finalizedPkgs, boolean newFormat)
      Add the module for the given package to the GAME layer and nuke all references to it from other layers
    • nukeAndFinalizeJava8

      public static void nukeAndFinalizeJava8(Set<Class<?>> getSourcesFrom, ClassLoader target, boolean first)
      Java 8 doesn't have modules, so move all classes loaded from the source of the given package to the target ClassLoader and things should work fine. Requires generated classes to be excluded from source searching.
    • removeServiceFrom

      public static void removeServiceFrom(String service, String impl, String layer)
    • resyncModules

      public static void resyncModules(ClassLoader loaderTo, String layerTo, ClassLoader loaderFrom)
      Since this class is intially loaded in the SERVICE layer which has BOOT as a parent separate from PLUGIN, we need a workaround for the PLUGIN layer thinking there are duplicate modules. This is needed since IModLanguageProvider implementations are forced into PLUGIN layer from service loading and can likely only be called via reflection.
    • sanityCheckModule

      public static void sanityCheckModule(Class<?> c, String name)
    • serviceProviderClass

      @Nullable public static Class<?> serviceProviderClass(Object servicesCatalog)
    • verifyModule

      public static void verifyModule(String className, net.minecraftforge.forgespi.language.IModInfo info, Object moduleLayer) throws Exception
      Throws:
      Exception