Class NeoForgeCoreLoader

java.lang.Object
mods.thecomputerizer.theimpossiblelibrary.neoforge.core.NeoForgeCoreLoader

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

    • NeoForgeCoreLoader

      public NeoForgeCoreLoader()
  • Method Details

    • bootLoader

      public static ClassLoader bootLoader()
      Should be the ClassLoader for the BOOT layer
    • 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)
      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
    • fixForServiceLayer

      public static void fixForServiceLayer()
    • fixService

      public static void fixService(String service, String impl, ClassLoader loaderFrom)
    • fixService

      public static void fixService(String service, String impl, ClassLoader loaderFrom, boolean isRemoval)
    • getBootLoadedCoreAPI

      @Nullable public static Object getBootLoadedCoreAPI()
    • getModuleFromPackage

      public static Module getModuleFromPackage(String pkg, String layerName, boolean newFormat)
    • initCoreAPI

      @Nullable public static Object initCoreAPI(ClassLoader loader)
      Returns a CoreAPI instance on the input ClassLoader. Initializes the source if necessary
    • layerClassLoader

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

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

      public static void nukeAndFinalize(net.neoforged.neoforgespi.language.IModInfo mod, String pkg, Set<String> finalizedPkgs)
      Add the module for the given package to the GAME layer and nuke all references to it from other layers
    • 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.neoforged.neoforgespi.language.IModInfo info, ModuleLayer layer) throws Exception
      Throws:
      Exception