Use dev.faststats.fabric.FabricContext for Fabric mods. Requires Java 17+ on both Fabric and Quilt.
The Fabric SDK also works on Quilt, since Quilt can load
Fabric mods. Use the same artifact and setup described below for Quilt mods.
Fabric API must be installed on both
Fabric and Quilt. Starting with Minecraft 26.1, Quilt can load the original
Fabric API. On earlier versions, Quilt users have to install Quilted Fabric
API instead.
Fabric and Quilt are supported on Minecraft 1.16.1 and all newer versions.
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.
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.
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 (or quilt.mod.json on
Quilt), to FabricContext.Factory.
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.