Package dev.architectury.platform
Class Platform
java.lang.Object
dev.architectury.platform.Platform
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path
Gets the mainconfig
folder for the current instance of Minecraft.static net.fabricmc.api.EnvType
getEnv()
Returns the current Environment the game is running in, as a member of theEnvType
enum.static Env
Returns the current Environment the game is running in, being one of eitherCLIENT
orSERVER
.static Path
Gets the root directory for the current instance of Minecraft.static String
static Mod
Gets aMod
container 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 ofMod
containers for all currently-loaded mods.static Path
Gets themods
folder of the current instance of Minecraft.getOptionalMod
(String id) Optionally gets aMod
container by its mod ID if it exists.static boolean
static boolean
isFabric()
static boolean
isForge()
static boolean
isModLoaded
(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 mainconfig
folder for the current instance of Minecraft.The returned path is guaranteed to be absolute and normalized.
-
getModsFolder
Gets themods
folder 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 eitherCLIENT
orSERVER
.The class returned is a platform-agnostic wrapper around the
EnvType
andDist
enums, respectively. -
getEnv
public static net.fabricmc.api.EnvType getEnv()Returns the current Environment the game is running in, as a member of theEnvType
enum. This is remapped on Forge to be theDist
enum, instead.- Returns:
- The current Environment, as an instance of
EnvType
(orDist
on Forge)
-
isModLoaded
Checks whether a mod with the given mod ID is present.- Parameters:
id
- The mod ID to check.- Returns:
true
if the mod is loaded,false
otherwise.
-
getMod
Gets aMod
container 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 aMod
container 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 ofMod
containers 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()
-