Class ParticleTypes

java.lang.Object
net.ixdarklord.coolcatcore.api.utils.ParticleTypes

public final class ParticleTypes extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(boolean alwaysSpawn, com.mojang.serialization.Codec<T> codec, net.minecraft.core.particles.ParticleOptions.Deserializer<T> deserializer)
    Creates a new particle type the 1.20.1 way, with a codec and a deserializer for network and command data.
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(boolean alwaysSpawn, com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> packetCodec)
    Creates a new particle type with a custom factory and codecs for packet/data serialization.
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(boolean alwaysSpawn, Function<net.minecraft.core.particles.ParticleType<T>,com.mojang.serialization.MapCodec<T>> codecGetter, Function<net.minecraft.core.particles.ParticleType<T>,StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T>> packetCodecGetter)
    Creates a new particle type with a custom factory and codecs for packet/data serialization.
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(com.mojang.serialization.Codec<T> codec, net.minecraft.core.particles.ParticleOptions.Deserializer<T> deserializer)
    Creates a new particle type the 1.20.1 way, with a codec and a deserializer for network and command data.
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> packetCodec)
    Creates a new particle type with a custom factory and codecs for packet/data serialization.
    static <T extends net.minecraft.core.particles.ParticleOptions>
    net.minecraft.core.particles.ParticleType<T>
    complex(Function<net.minecraft.core.particles.ParticleType<T>,com.mojang.serialization.MapCodec<T>> codecGetter, Function<net.minecraft.core.particles.ParticleType<T>,StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T>> packetCodecGetter)
    Creates a new particle type with a custom factory and codecs for packet/data serialization.
    static net.minecraft.core.particles.SimpleParticleType
     
    static net.minecraft.core.particles.SimpleParticleType
    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
  • Constructor Details

    • ParticleTypes

      public ParticleTypes()
  • Method Details

    • simple

      public static net.minecraft.core.particles.SimpleParticleType simple()
    • simple

      public static net.minecraft.core.particles.SimpleParticleType 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.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> packetCodec)
      Creates a new particle type with a custom factory and codecs for packet/data serialization.

      On 1.20.1, particle options write themselves to the network (ParticleOptions.writeToNetwork(net.minecraft.network.FriendlyByteBuf)): make it write what packetCodec reads, e.g. PACKET_CODEC.encode(buf, this). In commands, the options are given as SNBT that codec reads.

      Parameters:
      codec - The codec for serialization.
      packetCodec - The packet codec for network serialization.
    • complex

      public static <T extends net.minecraft.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(boolean alwaysSpawn, com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> packetCodec)
      Creates a new particle type with a custom factory and codecs for packet/data serialization. See complex(MapCodec, StreamCodec).
      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 net.minecraft.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(Function<net.minecraft.core.particles.ParticleType<T>,com.mojang.serialization.MapCodec<T>> codecGetter, Function<net.minecraft.core.particles.ParticleType<T>,StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T>> packetCodecGetter)
      Creates a new particle type with a custom factory and codecs for packet/data serialization. This method is useful when two different ParticleTypes share the same ParticleOptions implementation. See complex(MapCodec, StreamCodec).
      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 net.minecraft.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(boolean alwaysSpawn, Function<net.minecraft.core.particles.ParticleType<T>,com.mojang.serialization.MapCodec<T>> codecGetter, Function<net.minecraft.core.particles.ParticleType<T>,StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T>> packetCodecGetter)
      Creates a new particle type with a custom factory and codecs for packet/data serialization. This method is useful when two different ParticleTypes share the same ParticleOptions implementation. See complex(MapCodec, StreamCodec).
      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.
    • complex

      public static <T extends net.minecraft.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(com.mojang.serialization.Codec<T> codec, net.minecraft.core.particles.ParticleOptions.Deserializer<T> deserializer)
      Creates a new particle type the 1.20.1 way, with a codec and a deserializer for network and command data.
      Parameters:
      codec - The codec for serialization.
      deserializer - The particle deserializer for network and command serialization.
    • complex

      public static <T extends net.minecraft.core.particles.ParticleOptions> net.minecraft.core.particles.ParticleType<T> complex(boolean alwaysSpawn, com.mojang.serialization.Codec<T> codec, net.minecraft.core.particles.ParticleOptions.Deserializer<T> deserializer)
      Creates a new particle type the 1.20.1 way, with a codec and a deserializer for network and command data.
      Parameters:
      alwaysSpawn - True to always spawn the particle regardless of distance.
      codec - The codec for serialization.
      deserializer - The particle deserializer for network and command serialization.