OneConfig V1
  • Welcome
  • Documentation license
  • Introduction
    • Getting started
  • Configuration
    • Creating your config
      • Option dependencies & hiding options
      • Listening for option changes
    • Available options
      • Boolean options
        • Switch option
        • Checkbox option
      • Number options
        • Slider option
        • Number option
      • Selector options
        • Dropdown option
        • Radio button option
      • Text option
      • Color option
      • Keybind option
      • Buttons
      • Accordions
      • Decorations
    • Creating your own options
  • Commands
    • Annotation-based commands
    • Tree-based commands
  • Events
    • Using the events system
      • Callback events
      • Subscriber events
  • Utilities Module
    • Hypixel utilities
    • IO utilities
    • Networking utilities
    • JSON utilities
    • Multithreading
    • Platform-specific utilities
  • Migration
    • Temporary V0 -> V1 migration guide
    • Migrating your configs from Vigilance
Powered by GitBook
On this page
  • Mod loader platform
  • Getting the current Minecraft version
  • Getting the current mod loader name
  • Checking if we're in a developer environment
  • Checking if a specific mod ID is loaded
  • Getting all currently loaded mods
  • Player platform
  • Checking if the player is in multiplayer
  • Checking if the player currently exists (in a world)
  • Getting the player's username
  • Getting information about the server the player is connected to
  • GL platform
  • Screen platform
  • I18n platform
Export as PDF
  1. Utilities Module

Platform-specific utilities

The Platform class in OneConfig's utils module is a means to provide several methods which will serve the same function regardless of what Minecraft version or mod loader is currently being used by the player. It serves several general purpose, smaller platform utilities such a localization, mod loader, OpenGL, etc utilities.

Mod loader platform

Getting the current Minecraft version

LoaderPlatform#getMinecraftVersion (or Platform.loader().getMinecraftVersion()) returns a 0-padded representation of the current Minecraft version, f.ex: 11605 or 10809 which represent 1.16.5 and 1.8.9 respectively.

Getting the current mod loader name

LoaderPlatform#getLoader (or Platform.loader().getLoader()) returns the current mod loader, represented by the Loaders enum, which contains FORGE and FABRIC.

Checking if we're in a developer environment

LoaderPlatform#isDevelopmentEnvironment(or Platform.loader().isDevelopmentEnvironment()) can be used to check if the player is currently inside of a developer environment.

Checking if a specific mod ID is loaded

LoaderPlatform#isModLoaded(or Platform.loader().isModLoaded(String)) returns a boolean for if a mod with the given ID is currently loaded.

Getting all currently loaded mods

LoaderPlatform#getLoadedMods(or Platform.loader().getLoadedMods()) returns a list of ActiveMod instances, all containing information such as a mod's name, ID, version and where it was loaded from (it's source).

Player platform

Checking if the player is in multiplayer

PlayerPlatform#inMultiplayer(or Platform.player().inMultiplayer()) returns a boolean for if the player is currently connected to a multiplayer server or LAN world.

Checking if the player currently exists (in a world)

PlayerPlatform#inMultiplayer(or Platform.player().inMultiplayer()) returns a boolean for if the player is currently connected to a multiplayer server or LAN world.

Getting the player's username

Getting information about the server the player is connected to

GL platform

Screen platform

I18n platform

PreviousMultithreadingNextTemporary V0 -> V1 migration guide

Last updated 5 months ago