Class ModInfoProvider
java.lang.Object
com.thecsdev.commonmc.api.util.modinfo.ModInfoProvider
- Direct Known Subclasses:
FabricModInfoProvider, NeoForgeModInfoProvider
Provides information about currently installed mods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final ModInfoProviderReturns the currentModInfoProviderinstance, ornullif none is present at the moment.abstract @NotNull String[]Returns an array of all currently installed mod IDs/namespaces.abstract @NotNull ModInfogetModInfo(@NotNull String modid) Returns theModInfoobject for a given currently installed mod, ornullif no such mod is installed.final @NotNull StringReturns a unique ID for the current modpack installation, which is generated by hashing the list of currently installed mods and their versions.abstract booleanisModLoaded(@NotNull String modid) Returns whether a mod with the given ID/namespace is currently installed.static final voidsetInstance(@NotNull ModInfoProvider provider) Sets the currentModInfoProviderinstance.
-
Constructor Details
-
ModInfoProvider
public ModInfoProvider()
-
-
Method Details
-
getInstance
Returns the currentModInfoProviderinstance, ornullif none is present at the moment. -
setInstance
public static final void setInstance(@NotNull @NotNull ModInfoProvider provider) throws NullPointerException Sets the currentModInfoProviderinstance.- Parameters:
provider- The new provider to set.- Throws:
NullPointerException- When the argument isnull.
-
getModInfo
@NotNull public abstract @NotNull ModInfo getModInfo(@NotNull @NotNull String modid) throws NullPointerException, NoSuchElementException Returns theModInfoobject for a given currently installed mod, ornullif no such mod is installed.- Parameters:
modid- The unique namespace/ID of the mod.- Throws:
NullPointerException- When the argument isnull.NoSuchElementException- When no mod with the given ID/namespace is installed.
-
getLoadedModIDs
Returns an array of all currently installed mod IDs/namespaces. -
isModLoaded
Returns whether a mod with the given ID/namespace is currently installed.- Parameters:
modid- The unique namespace/ID of the mod.- Throws:
NullPointerException- When the argument isnull.
-
getModpackID
Returns a unique ID for the current modpack installation, which is generated by hashing the list of currently installed mods and their versions.
-