Class FabricDataGenerator
java.lang.Object
net.minecraft.data.DataGenerator
net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
An extension to vanilla's
DataGenerator providing mod specific data, and helper functions.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classRepresents a pack of generated data (i.e. -
Constructor Summary
ConstructorsConstructorDescriptionFabricDataGenerator(Path output, net.fabricmc.loader.api.ModContainer mod, boolean strictValidation, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) -
Method Summary
Modifier and TypeMethodDescriptionCreate a newFabricDataGenerator.Packinstance for generating a builtin resource pack.Create a defaultFabricDataGenerator.Packinstance for generating a mod's data.createVanillaPack(boolean shouldRun) Deprecated.createVanillaSubPack(boolean shouldRun, String packName) Deprecated.Please usecreateBuiltinResourcePack(Identifier)net.fabricmc.loader.api.ModContainerReturns theModContainerfor the mod that this data generator has been created for.getModId()Returns the mod ID for the mod that this data generator has been created for.Get a future returning the default registries produced byBuiltinRegistriesandDataGeneratorEntrypoint.buildRegistry(RegistryBuilder).booleanWhen enabled data providers can do strict validation to ensure that all entries have data generated for them.Methods inherited from class net.minecraft.data.DataGenerator
run
-
Constructor Details
-
FabricDataGenerator
@Internal public FabricDataGenerator(Path output, net.fabricmc.loader.api.ModContainer mod, boolean strictValidation, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture)
-
-
Method Details
-
createPack
Create a defaultFabricDataGenerator.Packinstance for generating a mod's data. -
createBuiltinResourcePack
Create a newFabricDataGenerator.Packinstance for generating a builtin resource pack.To be used in conjunction with
ResourceManagerHelper.registerBuiltinResourcePack(net.minecraft.util.Identifier, net.fabricmc.loader.api.ModContainer, net.fabricmc.fabric.api.resource.ResourcePackActivationType)The path in which the resource pack is generated is
"resourcepacks/<id path>".id pathbeing the path specified in the identifier. -
getModContainer
public net.fabricmc.loader.api.ModContainer getModContainer()Returns theModContainerfor the mod that this data generator has been created for.- Returns:
- a
ModContainerinstance
-
getModId
Returns the mod ID for the mod that this data generator has been created for.- Returns:
- a mod ID
-
isStrictValidationEnabled
public boolean isStrictValidationEnabled()When enabled data providers can do strict validation to ensure that all entries have data generated for them.- Returns:
- if strict validation should be enabled
-
getRegistries
Get a future returning the default registries produced byBuiltinRegistriesandDataGeneratorEntrypoint.buildRegistry(RegistryBuilder).Generally one does not need direct access to the registries, and instead can pass them directly to a
DataProviderby usingFabricDataGenerator.Pack.addProvider(Pack.RegistryDependentFactory). However, this method may be useful when extending the vanilla registries (such as withExperimentalRegistriesValidator).- Returns:
- A future containing the builtin registries.
-
createVanillaPack
Deprecated.Please usecreatePack()- Overrides:
createVanillaPackin classDataGenerator
-
createVanillaSubPack
Deprecated.Please usecreateBuiltinResourcePack(Identifier)- Overrides:
createVanillaSubPackin classDataGenerator
-
createPack()