Class FabricTagProvider<T>
java.lang.Object
net.minecraft.data.server.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 TypeClassDescriptionstatic 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.server.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.server.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 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.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.server.tag.TagProvider
getName, getRegistryLookupFuture, 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
-