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.BlockEntityTypeTagProvider
,FabricTagProvider.BlockTagProvider
,FabricTagProvider.EnchantmentTagProvider
,FabricTagProvider.EntityTypeTagProvider
,FabricTagProvider.FluidTagProvider
,FabricTagProvider.ItemTagProvider
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
Modifier and TypeClassDescriptionfinal class
A builder for tag alias groups.static class
Extend this class to createBlockEntityType
tags in the "/block_entity_type" tag directory.static class
Extend this class to createBlock
tags in the "/blocks" tag directory.static class
Extend this class to createEnchantment
tags in the "/enchantments" tag directory.static class
Extend this class to createEntityType
tags in the "/entity_types" tag directory.final class
An extension toTagProvider.ProvidedTagBuilder
that provides additional functionality.static class
Extend this class to createFluid
tags in the "/fluids" tag directory.static class
Extend this class to createItem
tags in the "/items" tag directory.Nested classes/interfaces inherited from class net.minecraft.data.tag.TagProvider
TagProvider.ProvidedTagBuilder<T>, 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, registryRef
Fields inherited from interface net.minecraft.data.DataProvider
JSON_KEY_SORT_ORDER, JSON_KEY_SORTING_COMPARATOR, LOGGER
-
Constructor Summary
ConstructorDescriptionFabricTagProvider
(FabricDataOutput output, RegistryKey<? extends Registry<T>> registryKey, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) Constructs a newFabricTagProvider
with the default computed path. -
Method Summary
Modifier and TypeMethodDescriptionprotected FabricTagProvider<T>.AliasGroupBuilder
aliasGroup
(String group) Gets anFabricTagProvider<T>.AliasGroupBuilder
with the given ID.protected FabricTagProvider<T>.AliasGroupBuilder
aliasGroup
(Identifier groupId) Gets anFabricTagProvider<T>.AliasGroupBuilder
with the given ID.protected abstract void
configure
(RegistryWrapper.WrapperLookup wrapperLookup) Implement this method and then usegetOrCreateTagBuilder(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.protected FabricTagProvider<T>.FabricTagBuilder
getOrCreateTagBuilder
(TagKey<T> tag) Creates a new instance ofFabricTagProvider<T>.FabricTagBuilder
for the givenTagKey
tag.protected RegistryKey
<T> reverseLookup
(T element) Override to enable adding objects to the tag builder directly.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 newFabricTagProvider
with the default computed path.Common implementations of this class are provided.
- Parameters:
output
- theFabricDataOutput
instanceregistriesFuture
- the backing registry for the tag type
-
-
Method Details
-
configure
Implement this method and then usegetOrCreateTagBuilder(net.minecraft.registry.tag.TagKey<T>)
to get and register new tag builders.- Specified by:
configure
in classTagProvider<T>
-
reverseLookup
Override to enable adding objects to the tag builder directly. -
getOrCreateTagBuilder
Creates a new instance ofFabricTagProvider<T>.FabricTagBuilder
for the givenTagKey
tag.- Overrides:
getOrCreateTagBuilder
in classTagProvider<T>
- Parameters:
tag
- TheTagKey
tag to create the builder for- Returns:
- The
FabricTagProvider<T>.FabricTagBuilder
instance
-
aliasGroup
Gets anFabricTagProvider<T>.AliasGroupBuilder
with the given ID.- Parameters:
groupId
- the group ID- Returns:
- the alias group builder
-
aliasGroup
Gets anFabricTagProvider<T>.AliasGroupBuilder
with 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
-