Interface PostFlattenTagRegistrar<T>

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

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

An example of a custom enchant being registered to the vanilla #minecraft:in_enchanting_table tag.


 class YourBootstrapClass implements PluginBootstrap {

     @Override
     public void bootstrap(BootstrapContext context) {
         LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
         manager.registerEventHandler(LifecycleEvents.TAGS.postFlatten(RegistryKey.ENCHANTMENT), event -> {
             final PostFlattenTagRegistrar<Enchantment> registrar = event.registrar();
             registrar.addToTag(
                 EnchantmentTagKeys.IN_ENCHANTING_TABLE,
                 Set.of(CUSTOM_ENCHANT)
             );
         });
     }
 }
 
See Also: