Interface DataGeneratorEntrypoint
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An entry point for data generation.
In fabric.mod.json, the entrypoint is defined with fabric-datagen key.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddJsonKeySortOrders(JsonKeySortOrderCallback callback) Provides a callback for setting the sort priority of object keys in generated JSON files.default voidbuildRegistry(RegistryBuilder registryBuilder) Builds a registry containing dynamic registry entries to be generated.default @Nullable StringReturns the mod ID of the mod the data is being generated for.voidonInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) RegisterDataProviderwith theFabricDataGeneratorduring this entrypoint.
-
Method Details
-
onInitializeDataGenerator
RegisterDataProviderwith theFabricDataGeneratorduring this entrypoint.- Parameters:
fabricDataGenerator- TheFabricDataGeneratorinstance
-
getEffectiveModId
Returns the mod ID of the mod the data is being generated for. Anullreturn will run the data generator using the mod ID that registered the current entrypoint.- Returns:
- a
Stringornull - Throws:
RuntimeException- If the mod ID does not exist.
-
buildRegistry
Builds a registry containing dynamic registry entries to be generated. Users should callRegistryBuilder.addRegistry(RegistryKey, RegistryBuilder.BootstrapFunction)to register a bootstrap function, which adds registry entries to be generated.This is invoked asynchronously.
- Parameters:
registryBuilder- aRegistryBuilderinstance
-
addJsonKeySortOrders
Provides a callback for setting the sort priority of object keys in generated JSON files.- Parameters:
callback- a callback for setting the sort priority for a given key
-