Class FabricParticleTypes
java.lang.Object
net.fabricmc.fabric.api.particle.v1.FabricParticleTypes
Methods for creating particle types, both simple and using an existing attribute factory.
Usage:
public static final SimpleParticleType SIMPLE_TEST_PARTICLE = FabricParticleTypes.simple();
public static final SimpleParticleType CUSTOM_TEST_PARTICLE = FabricParticleTypes.simple();
@Override
public void onInitialize() {
Registry.register(Registry.PARTICLE_TYPE, Identifier.of("testmod", "simple"), SIMPLE_TEST_PARTICLE);
Registry.register(Registry.PARTICLE_TYPE, Identifier.of("testmod", "custom"), CUSTOM_TEST_PARTICLE);
}}
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ParticleEffect>
ParticleType<T> complex(boolean alwaysSpawn, com.mojang.serialization.MapCodec<T> codec, PacketCodec<? super RegistryByteBuf, T> packetCodec) Creates a new particle type with a custom factory and codecs for packet/data serialization.static <T extends ParticleEffect>
ParticleType<T> complex(boolean alwaysSpawn, Function<ParticleType<T>, com.mojang.serialization.MapCodec<T>> codecGetter, Function<ParticleType<T>, PacketCodec<? super RegistryByteBuf, T>> packetCodecGetter) Creates a new particle type with a custom factory and codecs for packet/data serialization.static <T extends ParticleEffect>
ParticleType<T> complex(com.mojang.serialization.MapCodec<T> codec, PacketCodec<? super RegistryByteBuf, T> packetCodec) Creates a new particle type with a custom factory and codecs for packet/data serialization.static <T extends ParticleEffect>
ParticleType<T> complex(Function<ParticleType<T>, com.mojang.serialization.MapCodec<T>> codecGetter, Function<ParticleType<T>, PacketCodec<? super RegistryByteBuf, T>> packetCodecGetter) Creates a new particle type with a custom factory and codecs for packet/data serialization.static SimpleParticleTypesimple()Creates a new, default particle type for the given id.static SimpleParticleTypesimple(boolean alwaysSpawn) Creates a new, default particle type for the given id.
-
Method Details
-
simple
Creates a new, default particle type for the given id. -
simple
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(com.mojang.serialization.MapCodec<T> codec, PacketCodec<? super RegistryByteBuf, T> packetCodec) Creates a new particle type with a custom factory and codecs for packet/data serialization.- Parameters:
codec- The codec for serialization.packetCodec- The packet codec for network serialization.
-
complex
public static <T extends ParticleEffect> ParticleType<T> complex(boolean alwaysSpawn, com.mojang.serialization.MapCodec<T> codec, PacketCodec<? super RegistryByteBuf, T> packetCodec) Creates a new particle type with a custom factory and codecs for packet/data serialization.- Parameters:
alwaysSpawn- True to always spawn the particle regardless of distance.codec- The codec for serialization.packetCodec- The packet codec for network serialization.
-
complex
public static <T extends ParticleEffect> ParticleType<T> complex(Function<ParticleType<T>, com.mojang.serialization.MapCodec<T>> codecGetter, Function<ParticleType<T>, PacketCodec<? super RegistryByteBuf, T>> packetCodecGetter) Creates a new particle type with a custom factory and codecs for packet/data serialization. This method is useful when two differentParticleTypes share the sameParticleEffectimplementation.- Parameters:
codecGetter- A function that, given the newly created type, returns the codec for serialization.packetCodecGetter- A function that, given the newly created type, returns the packet codec for network serialization.
-
complex
public static <T extends ParticleEffect> ParticleType<T> complex(boolean alwaysSpawn, Function<ParticleType<T>, com.mojang.serialization.MapCodec<T>> codecGetter, Function<ParticleType<T>, PacketCodec<? super RegistryByteBuf, T>> packetCodecGetter) Creates a new particle type with a custom factory and codecs for packet/data serialization. This method is useful when two differentParticleTypes share the sameParticleEffectimplementation.- Parameters:
alwaysSpawn- True to always spawn the particle regardless of distance.codecGetter- A function that, given the newly created type, returns the codec for serialization.packetCodecGetter- A function that, given the newly created type, returns the packet codec for network serialization.
-