Skip to content

Data generation

DataGenRuns lets a mod’s Fabric data generator run end on its own once it has written its files, in place of a shutdown thread of the mod’s own.

Type Summary Status Since Side Thread
DataGenRuns Ends a Fabric data generator run once it has finished. Experimental 2.8.0 both setup

In your mod’s data generator entry point, with MapleLangProvider, one of the mod’s providers:

End the data generator run when it finishes
@Override
public void onInitializeDataGenerator(FabricDataGenerator generator) {
DataGenRuns.exitWhenFinished("mymod");
FabricDataGenerator.Pack pack = generator.createPack();
pack.addProvider(MapleLangProvider::new);
}

Experimental · Since 2.8.0 · Side: both · Thread: setup

  • Fabric API runs only the data generator entry points of the mod that fabric-api.datagen.modid names. When the providers live in a separate development-only mod, DataGenRuns#exitWhenFinished goes in that mod’s entry point, the one that runs.
  • Advancements: writing advancement files from the same data generator.