Colored Particles

Apr 29, 2018
Colored Particles
  • Colored Particles

    Learn how to colorize particles




    Introduction(top)


    As of version 1.12.2, there are 3 types of particles that are colorizeable: REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT .

    Spawn Particle(top)


    You will need to use the method Player.spawnParticle which takes the full set of available particle parameters. Specifically you will need to adjust the offset X,Y,Z parameters to control color, "extra" for brightness and "count" to toggle colorization.

    Parameters(top)


    What these parameters do in this specific case:
    • count: Must be set to 0, this enabled colorized particles. Note that this means you cannot spawn more than one colored particle at a time (via a single call/packet)
    • extra: This controls the brightness of the particle's color, generally you just want to set this to 1.
    • offsetX: Pass a value from 0 to 1 here to control the red component of the particle's color
    • offsetY: Pass a value from 0 to 1 here to control the green component of the particle's color
    • offsetZ: Pass a value from 0 to 1 here to control the blue component of the particle's color

    Example(top)


    So to spawn a green redstone particle, you would make a call like this:

    Code (Text):
    player.spawnParticle(Particle.REDSTONE, x, y, z, 0, 0.001, 1, 0, 1);
    You may have noticed that the red component is not set to zero. This is to work-around some specific client behavior, if the red component is zero the particle will always render as red. (Naturally...)

    This only affects the REDSTONE particle. If you'd like no red at all, you can use Float.MIN_VALUE and it will be virtually red-free.
  • Loading...
  • Loading...