Platform Abstraction

To access the current platform (loader), you may use Platform class.

Platform.isFabric()

Returns whether the current loader is Fabric, or any Fabric-like derivatives, such as Quilt.

Platform.isForge()

Returns whether the current loader is Forge.

Platform.getCurrentVersion()

Returns the current Minecraft version.

Platform.getGameFolder()

Returns the path to the game's .minecraft folder.

Platform.getConfigFolder()

Returns the path to the loader defined config folder, this is usually in .minecraft/config.

Platform.getModsFolder()

Returns the path to the loader defined mods folder, this is usually in .minecraft/mods.

Platform.getEnvironment()

Returns the current distribution the game is running on, either CLIENT or SERVER. The class returned is a platform-agnostic wrapper around the Fabric's EnvType and Forge's Dist enums.

Platform.getEnv()

Note: Only use this if you have Architectury Injectables, which is on by default.

Returns the current distribution the game is running on, either CLIENT or SERVER. The class returned is remapped to be the platform's type, either Fabric's EnvType and Forge's Dist enums.

Platform.isModLoaded(String id)

Returns whether a mod with the modid id is loaded.

Platform.getMod(String id)

Returns a wrapper for a mod with the modid id. Throws NoSuchElementException if the mod is not found.

Platform.getOptionalMod(String id)

Returns an optional wrapper for a mod with the modid id, if found.

Platform.getMods()

Returns the list of all mods loaded.

Platform.getModIds()

Returns the list of all modids.

Platform.isDevelopmentEnvironment()

Returns whether the current running Minecraft is ran from development.