Interface PreFlattenTagRegistrar<T>

Type Parameters:
T - the type of value in the tag
All Superinterfaces:
Registrar

@Experimental @NonExtendable public interface PreFlattenTagRegistrar<T> extends Registrar
Registrar for tags before they are flattened. Flattened tags are tags which have any nested tags resolved to the tagged values the nested tags point to. This registrar, being a pre-flatten registrar, allows for modification before that flattening has happened, when tags both point to individual entries and other nested tags.

An example of a tag being created in a pre-flatten registrar:


 class YourBootstrapClass implements PluginBootstrap {

     @Override
     public void bootstrap(@NotNull BootstrapContext context) {
         LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
         manager.registerEventHandler(LifecycleEvents.TAGS.preFlatten(RegistryKey.ITEM), event -> {
             final PreFlattenTagRegistrar<ItemType> registrar = event.registrar();
             registrar.setTag(AXE_PICKAXE, Set.of(
                 TagEntry.tagEntry(ItemTypeTagKeys.PICKAXES),
                 TagEntry.tagEntry(ItemTypeTagKeys.AXES)
             ));
         });
     }
 }
 
See Also: