Class FabricParticleTypes

java.lang.Object
net.fabricmc.fabric.api.particle.v1.FabricParticleTypes

public final class FabricParticleTypes extends Object
Methods for creating particle types, both simple and using an existing attribute factory.

Usage:

 public static final DefaultParticleType SIMPLE_TEST_PARTICLE = FabricParticleTypes.simple();
 public static final DefaultParticleType CUSTOM_TEST_PARTICLE = FabricParticleTypes.simple();

 @Override
 public void onInitialize() {
     Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "simple"), SIMPLE_TEST_PARTICLE);
     Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "custom"), CUSTOM_TEST_PARTICLE);
 }}
 
  • Method Details

    • simple

      public static DefaultParticleType simple()
      Creates a new, default particle type for the given id.
    • simple

      public static DefaultParticleType simple(boolean alwaysSpawn)
      Creates a new, default particle type for the given id.
      Parameters:
      alwaysSpawn - True to always spawn the particle regardless of distance.
    • complex

      public static <T extends ParticleEffect> ParticleType<T> complex(ParticleEffect.Factory<T> factory)
      Creates a new particle type with a custom factory for packet/data serialization.
      Parameters:
      factory - A factory for serializing packet data and string command parameters into a particle effect.
    • complex

      public static <T extends ParticleEffect> ParticleType<T> complex(boolean alwaysSpawn, ParticleEffect.Factory<T> factory)
      Creates a new particle type with a custom factory for packet/data serialization.
      Parameters:
      alwaysSpawn - True to always spawn the particle regardless of distance.
      factory - A factory for serializing packet data and string command parameters into a particle effect.