Class PotoFluxLoadingContext

java.lang.Object
net.minheur.potoflux.loader.PotoFluxLoadingContext

public final class PotoFluxLoadingContext extends Object
This is the main class which handles the loading of potoflux and all mods related compounds
  • Method Details

    • get

      public static PotoFluxLoadingContext get()
      Getter for the only loading context instance
      Returns:
      the potoflux loading context instance
    • checkUpdates

      public static void checkUpdates()
      Checks online for a newer version of potoflux.
      If there is one available, tells the user.
    • getModEventBus

      public ModEventBus getModEventBus()
      Getter for the only mod event bus
      Returns:
      the mod event bus
    • setDevEnv

      public static void setDevEnv(boolean pIsDevEnv)
      This should only be called once in the scope, setting the environment
      Parameters:
      pIsDevEnv - if the environment is dev
    • isDevEnv

      public static boolean isDevEnv()
      Checks if the env is dev
      Returns:
      if the env is dev
    • isProdEnv

      public static boolean isProdEnv()
      Checks if the env is prod
      Returns:
      if the env is prod
    • getDevScanUrls

      public static Collection<URL> getDevScanUrls()
      Used to get the URLs to scan for mods in dev environment
      Returns:
      the URLs to scan for mod in dev env
    • mkModClassLoader

      public static URLClassLoader mkModClassLoader()
      Create and fill a class loader in prod environment
      Returns:
      a class loader filled with prod mods
    • getCurrentClassLoader

      public static ClassLoader getCurrentClassLoader()
      Gets the active ClassLoader.
      Used when switching from main to mod class loader
      Returns:
      the active ClassLoader
    • setModClassLoader

      public static void setModClassLoader()
      Turns on the mod class loader
    • getPotofluxModDir

      public static Path getPotofluxModDir()
      Getter for the potoflux mods dir
      Returns:
      the potoflux mods dir
    • getModsClassLoader

      public static ClassLoader getModsClassLoader()
      Getter for the mod class loader (prod)
      Returns:
      the prod class loader
    • isModLoaded

      public static boolean isModLoaded(Mod mod)
      Checks if a mod is loaded
      Parameters:
      mod - the mod to check loading status
      Returns:
      if the mod is loaded
    • isModLoaded

      public static boolean isModLoaded(String modId)
      Checks if a mod is loaded
      Parameters:
      modId - the modID to check loading status
      Returns:
      if the mod is loaded
    • isModListed

      public static boolean isModListed(Mod mod)
      Checks if a mod is listed (known)
      Parameters:
      mod - the mod to check if listed
      Returns:
      if the mod is listed
    • isModListed

      public static boolean isModListed(String modId)
      Checks if a mod is listed (known)
      Parameters:
      modId - the modID to check if listed
      Returns:
      if the mod is listed
    • getModVersion

      public static String getModVersion(String modId)
      Gets a version of a mod.
      Parameters:
      modId - mod to get version
      Returns:
      the mod version if listed, null else
    • listMod

      public static boolean listMod(Mod mod, Class<?> modClass)
      Registers a mod to the listed
      Parameters:
      mod - mod to list
      modClass - the main class (annotated with Mod) of the mod
      Returns:
      if the mod has been listed successfully
    • loadMods

      public static void loadMods()
      Load mods that in listedMods and compatible.
    • openUpdateDialog

      public static void openUpdateDialog(Mod mod, boolean isCompatible, String lastest)
    • getLoadedMods

      public static List<String> getLoadedMods()
      Getter for a list of all loaded mods
      Returns:
      a list of all loaded mod IDs
    • getListedMods

      public static List<ModContainer> getListedMods()