public class ModUtils extends Object
Modifier and Type | Method and Description |
---|---|
static List<String> |
getEnabledModIds()
Returns the IDs of all currently enabled mods.
|
static List<String> |
getOverrides()
Returns all vanilla files that have been explicitly overridden in a mod's mod_info.json.
|
static boolean |
isClassPresent(String classCanonicalName)
Checks if a class is present within the loaded mods.
|
static boolean |
isModEnabled(String modId)
Check if a mod is enabled.
|
static boolean |
loadClassesIfClassIsPresent(String classCanonicalName,
List<String> classesToLoadCanonicalNames,
boolean initializeClasses)
Loads a
List of classes if a specific class is present, optionally initializing them in the process. |
public static boolean isClassPresent(String classCanonicalName)
Note: this does not initialize the class if it is present.
classCanonicalName
- The canonical name of the class to check for
(ex: "data.scripts.plugins.ExamplePlugin"
).true
if the class is present, false
otherwise.public static boolean loadClassesIfClassIsPresent(String classCanonicalName, List<String> classesToLoadCanonicalNames, boolean initializeClasses) throws ClassNotFoundException
List
of classes if a specific class is present, optionally initializing them in the process.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 if classCanonicalName
is present.initializeClasses
- Whether to initialize all newly loaded classes - used if they have static
initializers you want to run.true
if classCanonicalName
was present and classesToLoadCanonicalNames
were
loaded, false
otherwise.ClassNotFoundException
- If any of the classes in classesToLoadCanonicalNames
do not exist.public static boolean isModEnabled(String modId)
ModManagerAPI.isModEnabled(String)
.modId
- The ID of the mod to check.true
if the mod with ID modId
is enabled, false
otherwise.public static List<String> getEnabledModIds()
List
containing the Ids of all enabled mods.