Package dev.architectury.platform
Class Platform
java.lang.Object
dev.architectury.platform.Platform
-
Method Summary
Modifier and TypeMethodDescriptionstatic PathGets the mainconfigfolder for the current instance of Minecraft.static net.fabricmc.api.EnvTypegetEnv()Returns the current Environment the game is running in, as a member of theEnvTypeenum.static EnvReturns the current Environment the game is running in, being one of eitherCLIENTorSERVER.static PathGets the root directory for the current instance of Minecraft.static Stringstatic ModGets aModcontainer by its mod ID.static Collection<String>Gets a collection of Strings representing the mod IDs of all currently-loaded mods.static Collection<Mod>getMods()Gets a collection ofModcontainers for all currently-loaded mods.static PathGets themodsfolder of the current instance of Minecraft.getOptionalMod(String id) Optionally gets aModcontainer by its mod ID if it exists.static booleanstatic booleanisFabric()static booleanisForge()static booleanisModLoaded(String id) Checks whether a mod with the given mod ID is present.
-
Method Details
-
isFabric
public static boolean isFabric() -
isForge
public static boolean isForge() -
getMinecraftVersion
-
getGameFolder
Gets the root directory for the current instance of Minecraft.The returned path is guaranteed to be absolute and normalized.
-
getConfigFolder
Gets the mainconfigfolder for the current instance of Minecraft.The returned path is guaranteed to be absolute and normalized.
-
getModsFolder
Gets themodsfolder of the current instance of Minecraft.The returned path is guaranteed to be absolute and normalized.
-
getEnvironment
Returns the current Environment the game is running in, being one of eitherCLIENTorSERVER.The class returned is a platform-agnostic wrapper around the
EnvTypeandDistenums, respectively. -
getEnv
public static net.fabricmc.api.EnvType getEnv()Returns the current Environment the game is running in, as a member of theEnvTypeenum. This is remapped on Forge to be theDistenum, instead.- Returns:
- The current Environment, as an instance of
EnvType(orDiston Forge)
-
isModLoaded
Checks whether a mod with the given mod ID is present.- Parameters:
id- The mod ID to check.- Returns:
trueif the mod is loaded,falseotherwise.
-
getMod
Gets aModcontainer by its mod ID.- Parameters:
id- The mod ID to look for.- Returns:
- The mod container, if found.
- Throws:
NoSuchElementException- if no mod with the given ID exists
-
getOptionalMod
Optionally gets aModcontainer by its mod ID if it exists.- Parameters:
id- The mod ID to look for.- Returns:
- An optional representing the mod container, if found, or an empty optional otherwise.
-
getMods
Gets a collection ofModcontainers for all currently-loaded mods.- Returns:
- A collection of mod containers.
-
getModIds
Gets a collection of Strings representing the mod IDs of all currently-loaded mods.- Returns:
- A collection of all loaded mod IDs.
-
isDevelopmentEnvironment
public static boolean isDevelopmentEnvironment()
-