Skip to content

Banner Pattern Data Generation

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

Banner Pattern Data Generation

The @GenerateBannerPattern annotation is a data generation annotation that automatically creates banner pattern definitions for Minecraft mods using the Temporal API. It eliminates the need for manual JSON configuration by generating the necessary data providers at runtime.

Responsibilities / Purpose

  • Automatic data generation: Creates banner pattern definitions without manual JSON files
  • Pattern registration: Registers banner patterns for use in loom and banner crafting
  • Integration with data providers: Seamlessly integrates with NeoForge's banner pattern data generation system
  • Type safety: Ensures compile-time validation of banner pattern configurations

How it works

  1. Annotation processing: The annotation is processed by GenerateBannerPatternStrategy during the data generation phase
  2. Field extraction: The strategy extracts the ResourceKey<BannerPattern> from the annotated field
  3. Description creation: Creates a BannerPatternDescription containing the pattern resource key
  4. Provider registration: Automatically registers the banner pattern with ApiBannerPatternProvider for data generation

How to use / Configure

Apply the annotation to static fields of type ResourceKey<BannerPattern>:

public final class ModBannerPatterns {
    @GenerateBannerPattern
    public static final ResourceKey<BannerPattern> CUSTOM_PATTERN = 
        ResourceUtils.createKey(Registries.BANNER_PATTERN, "custom_pattern");
}

Annotation parameters

The @GenerateBannerPattern annotation has no parameters. It simply marks a ResourceKey<BannerPattern> field for automatic data generation.

Extension points

The annotation integrates with the Temporal API's strategy system:

  • Strategy implementation: GenerateBannerPatternStrategy handles the processing logic
  • Provider system: Uses ApiBannerPatternProvider for data generation
  • Transformer support: Compatible with BannerPatternTransformer for additional processing
  • Tag integration: Works seamlessly with @AddBannerPatternTag for pattern categorization

When to use

Use @GenerateBannerPattern when:

  • Creating custom banner patterns for your mod
  • Defining patterns for use in loom crafting recipes
  • Automating data generation for banner customization content
  • Ensuring consistent banner pattern configuration across your mod

The annotation is particularly useful for mods with multiple banner patterns, as it centralizes pattern configuration and eliminates manual JSON file management. It's commonly used alongside translation annotations and tag annotations to provide complete pattern definitions with proper localization and categorization.

Clone this wiki locally