HomeJavaModsEnvironmentDetector (API)
EnvironmentDetector (API)
ModsJava

EnvironmentDetector (API)

by FelixFGF · on Modrinth

EnvironmentDetector is a lightweight Fabric API that automatically detects launcher, platform, modpack, loader, and environment information through a…

⬇ Download on Modrinth
EnvironmentDetector (API) — screenshot 1

Join DC [middle small]

EnvironmentDetector API

A lightweight and crash-safe Minecraft environment detection API for Fabric, Quilt and modern modpack launchers.

EnvironmentDetector automatically identifies:

The API is designed for:


✨ Features

Automatic Launcher Detection

EnvironmentDetector can automatically detect:

No manual configuration required.


🧩 Compatibility

Supported Minecraft Versions

Primary Support

The project currently targets:


Backwards Compatibility

EnvironmentDetector mainly relies on:

The API does NOT deeply modify Minecraft internals and avoids complex mixins for detection logic.

Because of this, the project can also be ported to older versions like:

with only minimal adjustments:


Supported Mod Loaders

Fabric

✅ Full native support (Main target platform)

Quilt

✅ Full native support

Quilt supports Fabric mods natively and EnvironmentDetector includes dedicated Quilt detection logic.

This means logs will correctly show:

Loader=Quilt

instead of Fabric when running on Quilt.

NeoForge / Forge

⚡ Not natively supported

EnvironmentDetector is primarily a Fabric mod.

However, the mod works correctly through compatibility layers such as:

When used through these layers, the API can even detect that the environment is running on:


Technical Requirements

Java Version

Fabric Loader


Compatibility Overview

Feature Status
Minecraft 1.21.x ✅ Optimized & Tested
Fabric ✅ Native Support
Quilt ✅ Native Support
NeoForge / Forge ⚡ Via Connector Only
Dedicated Server ✅ Fully Compatible
Java 21 🛠️ Required

🧠 High Precision Detection System

Unlike many other mods, EnvironmentDetector does NOT rely on process names only.

Instead, it uses:

This avoids false positives and duplicate detections.

Example: Other mods may simply scan for "Modrinth" running on the system.

EnvironmentDetector instead uses a more advanced runtime-based detection system.

1. JVM Argument Scan

The API scans Minecraft startup arguments (the same information normally visible in logs and runtime launch parameters).

If the word:

modrinth

appears inside JVM arguments, launch paths or runtime parameters, the launcher is automatically detected as:

Modrinth App

This works reliably because the Modrinth launcher usually injects Modrinth-related paths or identifiers into the Minecraft runtime environment.


2. Manual Configuration Fallback

On first startup, EnvironmentDetector automatically creates:

config/environmentdetector.properties

Inside this file, custom values can be manually configured:

manual_pack_name=Your Modpack Name
manual_launcher_name=Your Custom Launcher

If these values are set, they always take highest priority and override automatic detection.

This allows:

to work reliably with the API.


🔍 Detection Logic

The API scans multiple directory levels to identify launcher structures.

Supported Markers

Modrinth App

CurseForge

Feather Client

NoRisk Client

GDLauncher

Prism Launcher / MultiMC

ATLauncher

Lunar / Badlion

Classpath keyword analysis:

Official Launcher


📜 Standardized Logging

After initialization, EnvironmentDetector outputs a unified log entry.

Example:

[EnvironmentDetector] Launcher=Modrinth App, Instance=Ultra Survival, NoRisk=false, Loader=Fabric, Version=1.21.1

Other examples:

[EnvironmentDetector] Launcher=CurseForge, Instance=BetterMC, NoRisk=false, Loader=Fabric, Version=1.21.1
[EnvironmentDetector] Launcher=NoRisk Client, Instance=Unknown Pack, NoRisk=true, Loader=Fabric, Version=1.21.1

Fallback:

[EnvironmentDetector] Unknown Environment

⚡ Performance

EnvironmentDetector runs once during startup and afterwards only serves cached data.


🛠 Developer Integration

Gradle Setup

repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}

Dependency

dependencies {
    modImplementation "maven.modrinth:environmentdetector-api:VERSION"
}

Replace VERSION with the latest release.


💻 Usage Example

public String getLauncherName() {
    if (FabricLoader.getInstance().isModLoaded("environmentdetector")) {
        return de.felixfgf.environmentdetector.EnvironmentDetectorAPI
                .getEnvironment()
                .launcher();
    }

    return "Vanilla";
}

⚠ Best Practices

Always use optional integration

Do NOT hard depend on EnvironmentDetector.

Always check:

FabricLoader.getInstance().isModLoaded("environmentdetector")

before using the API.


🚫 Common Mistakes

Wrong package

Correct package:

de.felixfgf.environmentdetector

NOT:

de.felixfgf.environmentdetector.api

Missing modLoaded check

Direct API access without checking if the mod exists can crash other mods.


Using placeholders every frame

Do not resolve placeholders every render frame. Cache values when opening menus or HUDs.


🐛 Bug Reports & Support

Found a bug or detection issue?

Please report:

Join the Discord server for support, bug reports and API discussions:

Join DC [middle small]


🎯 Goals

EnvironmentDetector is built to become the standard environment API for modern Minecraft launcher ecosystems 🚀

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more