Skip to content

Particle Sprite Set Data Generation

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

Particle Sprite Set Data Generation

The GenerateParticleSpriteSet annotation automates the generation of particle sprite definitions for Minecraft particles. It eliminates the need for manual JSON asset creation by programmatically registering particle sprites and sprite sets during data generation.

Responsibilities / Purpose

  • Automates sprite registration: Generates particle sprite definitions without manual JSON files
  • Supports sprite sets: Creates multi-frame sprite animations with configurable frame counts
  • Integrates with data generation: Works seamlessly with NeoForge's data generation system
  • Provides flexible configuration: Supports sprite ordering and frame count customization

How it works

  1. Annotation processing: The framework scans fields annotated with @GenerateParticleSpriteSet
  2. Data extraction: Extracts the particle type field value and annotation parameters
  3. Description creation: Creates a ParticleDescription record with the sprite configuration
  4. Registration: Stores the mapping in ApiParticleProvider.PARTICLE_SPRITES map
  5. Data generation: During data generation, the ApiParticleProvider processes these mappings:
    • Single sprites (count <= 1): Calls sprite() method
    • Sprite sets (count > 1): Calls spriteSet() with frame count and reverse flag

How to use / Configure

Apply the annotation to DeferredHolder<ParticleType<?>, ParticleType<T>> fields:

public final class ExampleParticleTypes {
    private static final ParticleTypeFactory PARTICLE_TYPE_FACTORY = InjectionPool.getFromInstance(ParticleTypeFactory.class);

    @RegisterParticleProvider(ExampleParticle.Provider.class) // Read about this annotation in Event section
    @GenerateParticleSpriteSet(id = "example:example", count = 6)
    public static final DeferredHolder<ParticleType<?>, ParticleType<SimpleParticleType>> EXAMPLE_PARTICLE_TYPE = 
        PARTICLE_TYPE_FACTORY.create("example", true);

    @RegisterParticleProvider(ExampleParticle.Provider.class) // Read about this annotation in Event section
    @GenerateParticleSpriteSet(id = "example:simple", count = 1)
    public static final DeferredHolder<ParticleType<?>, ParticleType<SimpleParticleType>> SIMPLE_PARTICLE_TYPE = 
        PARTICLE_TYPE_FACTORY.create("simple", true);
}

Annotation Parameters

  • id (required): Resource location for the sprite asset (e.g., "modid:particle_name")
  • count (optional, default: 1): Number of frames in the sprite set
    • 1: Single sprite
    • > 1: Multi-frame sprite set
  • reverse (optional, default: false): Whether to reverse the sprite animation order

Asset Requirements

Place sprite textures in the appropriate resource directory:

src/main/resources/assets/modid/particles/particle_name.png

For sprite sets with count > 1, the framework expects either:

  • A single sprite sheet with multiple frames
  • Multiple numbered sprite files (depending on Minecraft's sprite set handling)

When to use

  • Custom particles: When creating particles that require custom visual representations
  • Animated particles: When particles need multi-frame animations
  • Complex effects: When particle effects require precise sprite control
  • Data-driven mods: When you want to avoid manual JSON asset management

Extension Points

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

  • Strategy implementation: GenerateParticleSpriteSetStrategy handles the processing logic
  • Data provider: ApiParticleProvider extends NeoForge's ParticleDescriptionProvider
  • Custom providers: Can extend ApiParticleProvider for additional particle data generation needs

The annotation works in conjunction with @RegisterParticleProvider to provide complete particle registration and sprite generation capabilities.

Clone this wiki locally