Package org.lazywizard.lazylib
Class ModUtils
Object
ModUtils
Contains methods for dealing with mod level (non-gameplay) tasks.
- Since:
- 1.9b
- Author:
- LazyWizard
-
Method Summary
Modifier and TypeMethodDescriptionReturns the IDs of all currently enabled mods.Returns all vanilla files that have been explicitly overridden in a mod's mod_info.json.static booleanisClassPresent(String classCanonicalName) Checks if a class is present within the loaded mods.static booleanisModEnabled(String modId) Check if a mod is enabled.static booleanloadClassesIfClassIsPresent(String classCanonicalName, List<String> classesToLoadCanonicalNames, boolean initializeClasses) Loads aListof classes if a specific class is present, optionally initializing them in the process.
-
Method Details
-
isClassPresent
Checks if a class is present within the loaded mods.Note: this does not initialize the class if it is present.
- Parameters:
classCanonicalName- The canonical name of the class to check for (ex:"data.scripts.plugins.ExamplePlugin").- Returns:
trueif the class is present,falseotherwise.- Since:
- 1.9b
-
loadClassesIfClassIsPresent
public static boolean loadClassesIfClassIsPresent(String classCanonicalName, List<String> classesToLoadCanonicalNames, boolean initializeClasses) throws ClassNotFoundException Loads aListof classes if a specific class is present, optionally initializing them in the process.- Parameters:
classCanonicalName- The canonical name of the class to test for the presence of. If it is not present, no other classes will be loaded.classesToLoadCanonicalNames- The other classes to load ifclassCanonicalNameis present.initializeClasses- Whether to initialize all newly loaded classes - used if they have static initializers you want to run.- Returns:
trueifclassCanonicalNamewas present andclassesToLoadCanonicalNameswere loaded,falseotherwise.- Throws:
ClassNotFoundException- If any of the classes inclassesToLoadCanonicalNamesdo not exist.- Since:
- 2.3
-
isModEnabled
Check if a mod is enabled. Equivalent toModManagerAPI.isModEnabled(String).- Parameters:
modId- The ID of the mod to check.- Returns:
trueif the mod with IDmodIdis enabled,falseotherwise.- Since:
- 2.3
-
getEnabledModIds
Returns the IDs of all currently enabled mods.- Returns:
- A
Listcontaining the Ids of all enabled mods. - Since:
- 2.3
-
getOverrides
Returns all vanilla files that have been explicitly overridden in a mod's mod_info.json.- Returns:
- All vanilla files overridden by mods.
- Since:
- 2.3
-