Solved 1.13 colored particles

Discussion in 'Spigot Plugin Development' started by cocoraid, Jul 24, 2018.

  1. Hey,

    1.13 has started to break my code so my old method is:

    Code (Java):
    public class ColoredParticle {


        int r, g, b;
        private Particle particle;
        private Location loc;

        public ColoredParticle(Particle particle, Location loc, int r, int g, int b) {
            this.particle = particle;
            this.loc = loc;
            this.r = r;
            this.g = g;
            this.b = b;
        }

        public void send() {
            loc.getWorld().spawnParticle(particle, loc.getX(), loc.getY(), loc.getZ(), 0, color(r), color(g), color(b), 1);
        }

        public void send(Player p) {
            p.spawnParticle(particle, loc.getX(), loc.getY(), loc.getZ(), 0, color(r), color(g), color(b), 1);
        }

        private double color(double color) {
            color = color <= 0 ? -1 : color;
            return color / 255;
        }

    }
    And I can't find the way to fix this:
    Code (Text):
    Caused by: java.lang.IllegalArgumentException: Particle REDSTONE requires data, null provided
    Which data ?
    Thank you !
     
  2. The data the Redstone dust particle requires is Particle.DustOptions it will allow you to change the size and color of the particle.
     
    • Winner Winner x 2