Skip to content

Trim Pattern Data Generation

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

Trim Pattern Data Generation

The @GenerateTrimPattern annotation is a data generation annotation that automatically creates armor trim 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 trim pattern definitions without manual JSON files
  • Template association: Links trim patterns to their smithing template items
  • Decal configuration: Controls whether the pattern renders as a decal overlay
  • Integration with data providers: Seamlessly integrates with NeoForge's trim pattern data generation system

How it works

  1. Annotation processing: The annotation is processed by GenerateTrimPatternStrategy during the data generation phase
  2. Field extraction: The strategy extracts the ResourceKey<TrimPattern> from the annotated field
  3. Description creation: Creates a TrimPatternDescription containing the template item and decal setting
  4. Provider registration: Automatically registers the trim pattern with ApiTrimPatternProvider for data generation

How to use / Configure

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

public final class ModTrimPatterns {
    @GenerateTrimPattern(
        item = "mymod:custom_smithing_template",
        decal = false
    )
    public static final ResourceKey<TrimPattern> CUSTOM_TRIM_PATTERN = 
        ResourceUtils.createKey(Registries.TRIM_PATTERN, "custom_pattern");
}

Annotation parameters

  • item (String): The smithing template item resource location that represents this trim pattern
  • decal (boolean, default false): Whether the pattern should render as a decal overlay instead of a normal trim pattern

Extension points

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

  • Strategy implementation: GenerateTrimPatternStrategy handles the processing logic
  • Provider system: Uses ApiTrimPatternProvider for data generation
  • Transformer support: Compatible with TrimPatternTransformer for additional processing

When to use

Use @GenerateTrimPattern when:

  • Creating custom armor trim patterns for your mod
  • Defining patterns with specific smithing template requirements
  • Creating decal-style overlays for armor customization
  • Automating data generation for armor pattern content

The annotation is particularly useful for mods with multiple trim patterns, as it centralizes pattern configuration and eliminates manual JSON file management while providing control over how patterns are rendered and applied to armor pieces.

Clone this wiki locally