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);
 }}
 
See Also:
  • in the fabric example mods for a more complete usage.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends net.minecraft.particle.ParticleEffect>
    net.minecraft.particle.ParticleType<T>
    complex(boolean alwaysSpawn, net.minecraft.particle.ParticleEffect.Factory<T> factory)
    Creates a new particle type with a custom factory for packet/data serialization.
    static <T extends net.minecraft.particle.ParticleEffect>
    net.minecraft.particle.ParticleType<T>
    complex(net.minecraft.particle.ParticleEffect.Factory<T> factory)
    Creates a new particle type with a custom factory for packet/data serialization.
    static net.minecraft.particle.DefaultParticleType
    Creates a new, default particle type for the given id.
    static net.minecraft.particle.DefaultParticleType
    simple(boolean alwaysSpawn)
    Creates a new, default particle type for the given id.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • simple

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

      public static net.minecraft.particle.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 net.minecraft.particle.ParticleEffect> net.minecraft.particle.ParticleType<T> complex(net.minecraft.particle.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 net.minecraft.particle.ParticleEffect> net.minecraft.particle.ParticleType<T> complex(boolean alwaysSpawn, net.minecraft.particle.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.