Class FabricTagProvider<T>
java.lang.Object
net.minecraft.data.tag.TagProvider<T>
net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider<T>
- All Implemented Interfaces:
DataProvider
- Direct Known Subclasses:
FabricTagProvider.FabricValueLookupTagProvider
Implement this class (or one of the inner classes) to generate a tag list.
Register your implementation using FabricDataGenerator.Pack.addProvider(net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator.Pack.Factory<T>) in a DataGeneratorEntrypoint.
When generating tags for modded dynamic registry entries (such as biomes), either the entry
must be added to the registry using DataGeneratorEntrypoint.buildRegistry(RegistryBuilder)
or TagBuilder.addOptional(Identifier) must be used. Otherwise, the data generator cannot
find the entry and crashes.
Commonly used implementations of this class are provided:
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classA builder for tag alias groups.static classExtend this class to createBlockEntityTypetags in the "/block_entity_type" tag directory.static classExtend this class to createBlocktags in the "/block" tag directory.static classExtend this class to createEntityTypetags in the "/entity_type" tag directory.static classParent class for tag providers that support adding registered values directly.static classExtend this class to createFluidtags in the "/fluid" tag directory.static classExtend this class to createItemtags in the "/item" tag directory.Nested classes/interfaces inherited from class net.minecraft.data.tag.TagProvider
TagProvider.TagLookup<T>Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider
DataProvider.Factory<T extends DataProvider> -
Field Summary
Fields inherited from class net.minecraft.data.tag.TagProvider
pathResolver, registryRefFields inherited from interface net.minecraft.data.DataProvider
JSON_KEY_SORT_ORDER, JSON_KEY_SORTING_COMPARATOR, LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionFabricTagProvider(FabricDataOutput output, RegistryKey<? extends Registry<T>> registryKey, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) Constructs a newFabricTagProviderwith the default computed path. -
Method Summary
Modifier and TypeMethodDescriptionprotected FabricTagProvider<T>.AliasGroupBuilderaliasGroup(String group) Gets anFabricTagProvider<T>.AliasGroupBuilderwith the given ID.protected FabricTagProvider<T>.AliasGroupBuilderaliasGroup(Identifier groupId) Gets anFabricTagProvider<T>.AliasGroupBuilderwith the given ID.protected ProvidedTagBuilder<RegistryKey<T>, T> protected abstract voidconfigure(RegistryWrapper.WrapperLookup wrapperLookup) Implement this method and then usebuilder(net.minecraft.registry.tag.TagKey<T>)to get and register new tag builders.Returns a read-only map of alias group builders by the alias group ID.Methods inherited from class net.minecraft.data.tag.TagProvider
getName, getRegistriesFuture, getTagBuilder, getTagLookupFuture, run
-
Constructor Details
-
FabricTagProvider
public FabricTagProvider(FabricDataOutput output, RegistryKey<? extends Registry<T>> registryKey, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) Constructs a newFabricTagProviderwith the default computed path.Common implementations of this class are provided.
- Parameters:
output- theFabricDataOutputinstanceregistriesFuture- the backing registry for the tag type
-
-
Method Details
-
configure
Implement this method and then usebuilder(net.minecraft.registry.tag.TagKey<T>)to get and register new tag builders.- Specified by:
configurein classTagProvider<T>
-
builder
-
aliasGroup
Gets anFabricTagProvider<T>.AliasGroupBuilderwith the given ID.- Parameters:
groupId- the group ID- Returns:
- the alias group builder
-
aliasGroup
Gets anFabricTagProvider<T>.AliasGroupBuilderwith the given ID.- Parameters:
group- the group name- Returns:
- the alias group builder
-
getAliasGroupBuilders
Returns a read-only map of alias group builders by the alias group ID..- Returns:
- a read-only map of alias group builders by the alias group ID
-