Skip to content

Tag Data Generation

Maksym Uimanov edited this page Feb 12, 2026 · 1 revision

Tag Data Generation

The Temporal API provides a comprehensive set of annotations for automatically registering tags during data generation. These annotations eliminate the need for manual JSON tag file creation by programmatically adding objects to existing or custom tags.

Responsibilities / Purpose

  • Automates tag registration: Adds objects to tags without manual JSON files
  • Supports multiple tag types: Covers all major Minecraft registry types
  • Integrates with data generation: Works seamlessly with NeoForge's data generation system
  • Enables custom tags: Supports both vanilla and custom tag creation

How it works

  1. Annotation processing: The framework scans fields annotated with tag annotations
  2. Tag resolution: Resolves tag identifiers to appropriate TagKey instances
  3. Registration: Adds the annotated object to the specified tags
  4. Data generation: During data generation, tag JSON files are automatically generated

Common Tag Annotations

@AddBlockTag

Adds blocks to specified block tags.

@AddBlockTag({"minecraft:mineable/pickaxe", "minecraft:needs_diamond_tool"})
public static final DeferredBlock<?> EXAMPLE_ORE = BLOCK_FACTORY.create("example_ore", BlockPropertiesFactory.stone());

Parameters:

  • value (required): Array of tag resource locations to add the block to

@AddItemTag

Adds items to specified item tags.

@AddItemTag({"example:repairs_example_armor", "minecraft:trim_materials"})
public static final DeferredItem<?> EXAMPLE_INGOT = ITEM_FACTORY.create("example_ingot");

Parameters:

  • value (required): Array of tag resource locations to add the item to

Entity and Variant Tags

@AddEntityTypeTag

Adds entity types to specified entity tags.

Parameters:

  • value (required): Array of tag resource locations to add the entity type to

@AddCatVariantTag

Adds cat variants to specified cat variant tags.

@AddCatVariantTag("minecraft:default_spawns")
public static final DeferredHolder<CatVariant, CatVariant> EXAMPLE = CAT_VARIANT_FACTORY.create("example");

Parameters:

  • value (required): Array of tag resource locations to add the cat variant to

World Generation Tags

@AddBiomeTag

Adds biomes to specified biome tags.

Parameters:

  • value (required): Array of tag resource locations to add the biome to

@AddStructureTag

Adds structures to specified structure tags.

Parameters:

  • value (required): Array of tag resource locations to add the structure to

Game Mechanics Tags

@AddEnchantmentTag

Adds enchantments to specified enchantment tags.

Parameters:

  • value (required): Array of tag resource locations to add the enchantment to

@AddGameEventTag

Adds game events to specified game event tags.

Parameters:

  • value (required): Array of tag resource locations to add the game event to

@AddDamageTypeTag

Adds damage types to specified damage type tags.

Parameters:

  • value (required): Array of tag resource locations to add the damage type to

Creative and Utility Tags

@AddFluidTag

Adds fluids to specified fluid tags.

Parameters:

  • value (required): Array of tag resource locations to add the fluid to

@AddInstrumentTag

Adds instruments to specified instrument tags.

@AddInstrumentTag("example:example")
public static final DeferredHolder<Instrument, Instrument> EXAMPLE = INSTRUMENT_FACTORY.create("example", ExampleSounds.EXAMPLE_SOUND, 10, 15f);

Parameters:

  • value (required): Array of tag resource locations to add the instrument to

@AddPaintingVariantTag

Adds painting variants to specified painting variant tags.

Parameters:

  • value (required): Array of tag resource locations to add the painting variant to

@AddPointOfInterestTypeTag

Adds point of interest types to specified POI tags.

Parameters:

  • value (required): Array of tag resource locations to add the POI type to

@AddBannerPatternTag

Adds banner patterns to specified banner pattern tags.

Parameters:

  • value (required): Array of tag resource locations to add the banner pattern to

Tag Container Management

@AddTagContainer

Registers a class as a tag container for dynamic tag resolution (it is mandatory for use inside any other data generation annotation).

@AddTagContainer(TagContainerType.ITEM)
public final class ExampleItemTags {
    public static final TagKey<Item> REPAIRS_EXAMPLE_ARMOR = TagUtils.createItem("repairs_example_armor");
}

Parameters:

  • value (required): Type of tag container (ITEM, BLOCK, BIOME, ENCHANTMENT)

Available container types:

  • ITEM: Item tag container
  • BLOCK: Block tag container
  • BIOME: Biome tag container
  • ENCHANTMENT: Enchantment tag container

Tag Format and Structure

Tags follow Minecraft's standard resource location format:

namespace:tag_name

Examples:

  • "minecraft:mineable/pickaxe" - Vanilla tag
  • "example:custom_tag" - Custom tag

When to use

  • Tool requirements: Use appropriate mining tags for blocks
  • Mechanical behavior: Use tags for game mechanics (trimming, fuel, etc.)
  • Entity grouping: Use entity tags for mob behavior and spawning
  • World generation: Use biome and structure tags for world features
  • Custom categories: Create custom tags for mod-specific grouping
  • Compatibility: Use Forge tags for cross-mod compatibility

Extension Points

The annotation system integrates with Temporal API's metadata processing:

  • Tag resolution: Automatic tag key creation and resolution
  • Container management: Dynamic tag container registration
  • Cross-mod support: Built-in support for Forge tags
  • Custom tags: Automatic creation of custom tag files

Each annotation maps to a specific tag registration strategy that handles the tag addition logic, allowing for easy extension and customization of the tag registration system.

Clone this wiki locally