How to color "instantSpell" particle?

Discussion in 'Spigot Plugin Development' started by CruzAPI, Jul 3, 2018.

  1. Code (Text):
    String name = "instantSpell";
    float x = (float) p.getLocation().getX();
    y = (float) p.getLocation().getY();
    z = (float) p.getLocation().getZ();
    setX = 1.0F; //R
    setY = 0.0F; //G
    setZ = 0.0F; //B
    speed = 1.0F;
    amount = 1;

    ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldParticles(name, x, y, z, setX, setY, setZ, speed, amount));
    If I use "mobSpell" instead it get colored.
    I already tried set speed to 0 or amount 0 but not worked.
     
  2. Why use packets? There's an API for this
     
    • Agree Agree x 1
  3. Not sure in this case, but I've had to use packets before simply because the API constructs a new packet each call. When you're sending thousand/millions a second you want to be able to reuse as many objects as possible for efficiency. ;)

    @CruzAPI some particles can't be colored. Your code looks fine. Try using redstone particle just to test to make sure the code is right.
     
    • Agree Agree x 1
  4. amount needs to be 0, not 1.