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
Modifier and TypeClassDescriptionfinal class
Represents a pack of generated data (i.e. -
Constructor Summary
ConstructorDescriptionFabricDataGenerator
(Path output, net.fabricmc.loader.api.ModContainer mod, boolean strictValidation, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) -
Method Summary
Modifier and TypeMethodDescriptionCreate a newFabricDataGenerator.Pack
instance for generating a builtin resource pack.Create a defaultFabricDataGenerator.Pack
instance for generating a mod's data.createVanillaPack
(boolean shouldRun) Deprecated.createVanillaSubPack
(boolean shouldRun, String packName) Deprecated.Please usecreateBuiltinResourcePack(Identifier)
net.fabricmc.loader.api.ModContainer
Returns theModContainer
for 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 byBuiltinRegistries
andDataGeneratorEntrypoint.buildRegistry(RegistryBuilder)
.boolean
When 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.Pack
instance for generating a mod's data. -
createBuiltinResourcePack
Create a newFabricDataGenerator.Pack
instance 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 path
being the path specified in the identifier. -
getModContainer
public net.fabricmc.loader.api.ModContainer getModContainer()Returns theModContainer
for the mod that this data generator has been created for.- Returns:
- a
ModContainer
instance
-
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 byBuiltinRegistries
andDataGeneratorEntrypoint.buildRegistry(RegistryBuilder)
.Generally one does not need direct access to the registries, and instead can pass them directly to a
DataProvider
by 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:
createVanillaPack
in classDataGenerator
-
createVanillaSubPack
Deprecated.Please usecreateBuiltinResourcePack(Identifier)
- Overrides:
createVanillaSubPack
in classDataGenerator
-
createPack()