Fabric
Integrate FastStats with Fabric mods
Use dev.faststats.fabric.FabricContext for Fabric mods. Requires Java 21+.
Fabric supports Minecraft versions 1.16.1 to 26.3. Select both the SDK version and the exact Minecraft version in your dependency version. You can find the available Minecraft version targets in the Maven repository.
Artifact: dev.faststats.metrics:fabric
implementation("dev.faststats.metrics:fabric:0.31.0-pre2+mc26.3")
include("dev.faststats.metrics:fabric:0.31.0-pre2+mc26.3")Use both implementation and include. FastStats is provided as a mod through
jar-in-jar, so implementation puts it on your compile classpath and include
bundles it into your mod JAR.
The version format is {sdk-version}+mc{minecraft-version}, where
{sdk-version} is the FastStats SDK version and {minecraft-version} is the
exact Minecraft version you are targeting. Each artifact is built for a single
Minecraft version, so pick the one matching your mod.
0.31.0-pre2 is a pre-release and is published to the snapshots repository
(https://repo.faststats.dev/snapshots).
import dev.faststats.ErrorTracker;
import dev.faststats.Metrics;
import dev.faststats.fabric.FabricContext;
import net.fabricmc.api.ModInitializer;
public class ExampleMod implements ModInitializer {
public static final ErrorTracker ERROR_TRACKER = ErrorTracker.contextAware();
private final FabricContext context = new FabricContext.Factory("example-mod", "YOUR_TOKEN")
.errorTrackerService(ERROR_TRACKER)
.metrics(Metrics.Factory::create)
.create();
@Override
public void onInitialize() {
// your actual logic
}
}Pass your mod ID, as defined in fabric.mod.json, to FabricContext.Factory.
Client Consent Screen
The client consent screen is available starting with 0.31.0-pre2.
Pre-releases are published to the snapshots repository, so add
https://repo.faststats.dev/snapshots to your repositories to use it.
Explicit user consent is opt-in. To require it for your mod, call
requireConsent() on FabricContext.Factory:
private final FabricContext context = new FabricContext.Factory("example-mod", "YOUR_TOKEN")
.requireConsent()
.errorTrackerService(ERROR_TRACKER)
.metrics(Metrics.Factory::create)
.create();When at least one installed mod requires explicit consent, the client shows a consent screen on startup. The screen is only shown once. If a mod that requires explicit consent is installed after mods that did not require it, the screen is still shown on the next startup.
See Error Tracking for configuring error reporting.