Interface IPlatformHelper

All Known Implementing Classes:
PlatformHelperFabric

public interface IPlatformHelper
The PlatformHelper provides useful context and information about the platform the game is running on.
  • Method Details

    • getGamePath

      Path getGamePath()
      Gets the working directory path of the game directory.
      Returns:
      The working directory path of the game directory.
    • getGameDirectory

      default File getGameDirectory()
      Gets the working directory of the game as a File.
      Returns:
      The working directory of the game.
    • getConfigPath

      Path getConfigPath()
      Gets the specified configuration path for the game.
      Returns:
      The specified configuration path for the game.
    • getConfigDirectory

      default File getConfigDirectory()
      Gets the specified configuration directory as a file reference.
      Returns:
      The specified configuration path for the game.
    • getModsPath

      Path getModsPath()
      Gets the primary path that the current loader will load mods from.
      Returns:
      The currently specified mods path.
    • getModsDirectory

      default File getModsDirectory()
      Gets the primary directory that the current loader will load mods from.
      Returns:
      The currently specified mods directory.
    • getLoadedMods

      Set<String> getLoadedMods()
      Gets a set of loaded mod IDs.
      Returns:
      A set of loaded mod IDs.
    • isModLoaded

      boolean isModLoaded(String modId)
      Checks if a given mod is loaded.
      Parameters:
      modId - The mod id to search for.
      Returns:
      True when the specified mod id has been loaded.
    • isDevelopmentEnvironment

      boolean isDevelopmentEnvironment()
      Checks if the mod is running in a development environment.
      Returns:
      True when the mod is running in a developer environment.
    • getPhysicalSide

      PhysicalSide getPhysicalSide()
      Gets the physical environment that the code is running on.
      Returns:
      The physical environment that the code is running on.
    • isPhysicalClient

      default boolean isPhysicalClient()
      Checks if the code is running on a physical client.
      Returns:
      Returns true when the code is running on a physical client.
    • getModName

      @Nullable String getModName(String modId)
      Attempts to resolve the name of a mod using the associated mod ID. If no mod is not available the provided ID will be treated as the name.
      Parameters:
      modId - The ID of the mod to lookup.
      Returns:
      The name of the mod associated with the given mod ID. If no mod is not available the provided ID will be treated as the name.
    • getModVersion

      @Nullable String getModVersion(String modId)
    • getModNameComponent

      @Nullable default net.minecraft.network.chat.MutableComponent getModNameComponent(String modId)
      Attempts to resolve the name of a mod using the associated mod ID. If no mod is not available the provided ID will be treated as the name.
      Parameters:
      modId - The ID of the mod to lookup.
      Returns:
      The name of the mod associated with the given mod ID. If no mod is not available the provided ID will be treated as the name.
    • isTestingEnvironment

      boolean isTestingEnvironment()
      Checks if the mod is currently running in an environment with game tests enabled.
      Returns:
      Are game tests currently enabled?
    • getName

      String getName()
      Gets the name of the platform.
      Returns:
      The name of the platform.