IPlatformHelper

interface IPlatformHelper

Properties

Link copied to clipboard
abstract val cacheDir: Path

A directory this mod owns and may write to — every REPL cache lives under it. Asked of the loader, not derived from user.dir: that is the process cwd, which only happens to be the game dir. Pure — callers create what they need.

Link copied to clipboard
abstract val configPath: Path

This mod's config FILE, laid out where each loader's users look for one. Creates neither the file nor its parent directory.

Link copied to clipboard

Physical side, a launch-time constant. Opens the auth gate once at init on a dedicated server.

Link copied to clipboard
abstract val minecraftVersion: String

The running Minecraft version string (e.g. "1.18.2"), read from the loader — each loader knows it natively. Used to fetch version-matched remap mappings on a non-mojmap (Fabric intermediary / Forge SRG) runtime, where the processed runtime MC jar carries no version.json to read it from.

Link copied to clipboard
abstract val modVersion: String

This mod's own version string, looked up FROM the loader by Constants.MOD_ID — the same value Gradle injected into each loader's metadata file (fabric.mod.json / mods.toml / neoforge.mods.toml) from gradle.properties. "unknown" if the loader can't resolve our own container.

Link copied to clipboard
abstract val platformId: String

Fork brand + loader build, e.g. "Purpur/git-Purpur-2062" — compared with ==, never parsed. Keys the mojmap symbol cache, so it must change whenever the runtime's net.minecraft bytes could (take the brand from the runtime wherever one is published) and must never change within one build.

Functions

Link copied to clipboard
abstract fun isModLoaded(modId: String): Boolean
Link copied to clipboard
open fun isServerRunning(handle: Any?): Boolean

The server lane's readiness probe, defaulted to the MinecraftServer every loader's heartbeat hands in. Here rather than inlined in Lanes so that class — loaded on every platform — stays free of the type, and a host that pumps the lane with something else can override.

Link copied to clipboard

Where every loaded mod's code lives (including jar-in-jar / nested modules), for the REPL compile classpath. Fabric via FabricLoader.getAllMods(); Forge and NeoForge via ModList ->IModFile.

Link copied to clipboard
open fun pluginCodePaths(): List<Path>?

Where a hybrid server's plugins live, so a script can import plugin APIs. A plugin host overrides this and asks the plugin manager.

Link copied to clipboard
open fun runCommands(handle: Any, command: String): String

run_command target=server: run command (possibly multi-line) on the server thread and return its captured feedback. handle is the server lane's tick source. Defaulted to the NMS path, which a host whose runtime is not mojmap-named must replace wholesale rather than remap.