Package net.minheur.potoflux.loader
Class PotoFluxLoadingContext
java.lang.Object
net.minheur.potoflux.loader.PotoFluxLoadingContext
This is the main class which handles the loading of potoflux and all mods related compounds
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidChecks online for a newer version of potoflux.
If there is one available, tells the user.static PotoFluxLoadingContextget()Getter for the only loading context instancestatic ClassLoaderGets the activeClassLoader.
Used when switching from main to mod class loaderstatic Collection<URL>Used to get the URLs to scan for mods in dev environmentGetter for a list of all loaded modsGetter for the only mod event busstatic ClassLoaderGetter for the mod class loader (prod)static StringgetModVersion(String modId) Gets a version of a mod.static PropertiesGetter for the optional featuresstatic PathGetter for the potoflux mods dirstatic booleanisDevEnv()Checks if the env is devstatic booleanisModListed(String modId) Checks if a mod is listed (known)static booleanisModListed(Mod mod) Checks if a mod is listed (known)static booleanisModLoaded(String modId) Checks if a mod is loadedstatic booleanisModLoaded(Mod mod) Checks if a mod is loadedstatic booleanChecks if the env is prodstatic booleanRegisters a mod to the listedstatic voidCalled to load optional features from the filestatic voidloadMods()Load mods that inlistedModsand compatible.static URLClassLoaderCreate and fill a class loader in prod environmentstatic voidopenUpdateDialog(Mod mod, boolean isCompatible, String lastest) static voidsetDevEnv(boolean pIsDevEnv) This should only be called once in the scope, setting the environmentstatic voidTurns on the mod class loader
-
Method Details
-
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
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
-
loadFeatures
public static void loadFeatures()Called to load optional features from the file -
getOptionalFeatures
Getter for the optional features- Returns:
- the optional features
-
getDevScanUrls
Used to get the URLs to scan for mods in dev environment- Returns:
- the URLs to scan for mod in dev env
-
mkModClassLoader
Create and fill a class loader in prod environment- Returns:
- a class loader filled with prod mods
-
getCurrentClassLoader
Gets the activeClassLoader.
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
Getter for the potoflux mods dir- Returns:
- the potoflux mods dir
-
getModsClassLoader
Getter for the mod class loader (prod)- Returns:
- the prod class loader
-
isModLoaded
Checks if a mod is loaded- Parameters:
mod- the mod to check loading status- Returns:
- if the mod is loaded
-
isModLoaded
Checks if a mod is loaded- Parameters:
modId- the modID to check loading status- Returns:
- if the mod is loaded
-
isModListed
Checks if a mod is listed (known)- Parameters:
mod- the mod to check if listed- Returns:
- if the mod is listed
-
isModListed
Checks if a mod is listed (known)- Parameters:
modId- the modID to check if listed- Returns:
- if the mod is listed
-
getModVersion
Gets a version of a mod.- Parameters:
modId- mod to get version- Returns:
- the mod version if listed,
nullelse
-
listMod
Registers a mod to the listed- Parameters:
mod- mod to listmodClass- the main class (annotated withMod) of the mod- Returns:
- if the mod has been listed successfully
-
loadMods
public static void loadMods()Load mods that inlistedModsand compatible. -
openUpdateDialog
-
getLoadedMods
Getter for a list of all loaded mods- Returns:
- a list of all loaded mod IDs
-