Custom particles require a registered ParticleType and a particle description JSON file that lists the sprite textures for the particle to cycle through. The description file can be generated automatically using ParticleDescriptionProvider, keeping it in sync with your registered types.
gatherClientData listener.Registering a Particle Type
Particle types live in the minecraft:particle_type registry. Create a ParticleRegistry class in your common registry package:
SimpleParticleType is the standard particle type for particles that carry no extra data. The boolean argument controls whether the particle can be sent to clients who are playing with minimal particles; pass false to respect the player's setting and true to always show it.
Call ParticleRegistry.init() from CommonClass.init():
Particle Description Provider
In your NeoForge data package, create ExampleParticleDescriptionProvider extending ParticleDescriptionProvider:
The single-texture overload of spriteSet registers exactly one sprite for the particle. The identifier points to a texture in assets/<namespace>/textures/particle/, without the .png extension.
spriteSet(ParticleRegistry.EXAMPLE_PARTICLE.get(),
Identifier.fromNamespaceAndPath(Constants.MOD_ID, "example_particle"),
8, // number of frames
false); // reverse orderThis generates references to
example_particle_0.png through example_particle_7.png. The particle renderer cycles through them in sequence.Adding Sprite Textures
Datagen writes the description JSON but does not create textures. Place your sprite at:
Particle sprites are typically small squares (8x8 or 16x16 pixels) with an alpha channel for transparency. The game scales them based on the particle's size at runtime, so keep the texture simple.
Registering the Provider
Particle descriptions are client-side assets, so register the provider inside gatherClientData:
Testing In-Game
Run the NeoForge Data configuration. Check that assets/examplemod/particles/example_particle.json appears in the generated resources folder:
To spawn the particle in-game for a quick visual check, use the particle command from the server console or a command block:
If the particle shows as a white square or is missing entirely, verify that the texture file exists at the correct path and that the identifier in spriteSet matches the file name exactly.
You can find the source for this tutorial here:
View Source on GitHubData Generation: Enchantments (MultiLoader 26.1+)
Define a custom enchantment as a datapack registry entry using RegistrySetBuilder and DatapackBuiltinEntriesProvider, set weight, level, cost formula, and compatible item tags, and generate the enchantment JSON.
Continue →