Solved Colored Particle Effects

Discussion in 'Plugin Development' started by GamerzKing, Dec 9, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    GamerzKing

    Hey guys!

    I am currently making a game that requires me to create a "rainbow" particle effect that is shot from the player, however when I attempt to use SPELL_MOB, it just displays a black particle effect. I understand why, however I am not sure how to add the color to them.

    I am using @DarkBladee12 's https://bukkit.org/threads/1-8-particleeffect-v1-7.154406/ utility, and I am attempting to use:

    Code:
    ParticleEffect.NAME.display(OrdinaryColor color, Location center, double range);
    as the arguments, however I just don't understand the coloring.

    My code (doesn't contain color arguments):
    Code:
    ParticleEffect.SPELL_MOB.display(0F, 0F, 0F, 0F, 1, point, 500D);
    If anyone could help me, that would be greatly appreciated! Thanks!
    - GamerzKing
     
  2. Offline

    Zombie_Striker

    @GamerzKing
    This does not make that much sense (comparing it to your code):
    • Is OrdinaryColor a class? If so, why not use that for the colors?
    • Location should be the x,y,z of the place the effect is spawned, but you have "0f,0f,0f", making me think it's an offset. Which is it?
    • The range of the particles (max distance that they can be seen from) are actually booleans. Either false which equals 256, or true which is 65536.
     
  3. Offline

    GamerzKing

    - It's not a class, it's part of the ParticleEffect class, I just don't know how to use it.
    - point is a location, and if you click the link I posted in the thread, you will see that 0 are the offsets, and I use point for the location, for the Location argument.
    - In this case, it is a double, in the library, please go check that out. I will change to 256 :)
     
  4. Offline

    Zombie_Striker

    @GamerzKing
    If it's not a class, how can it be a parameter?

    [Edit] looked at the link given. It is it's own class. You have to create a new OrdinaryColor class and input the RGB color codes. You may need this :Click This.
    I work with packets, so I did not think that anyone would think on converting doubles to booleans. He may be using those values some other way then.
     
  5. Offline

    mcdorli

    I don't like this lib. It just makes some things difficult. Sending a particle packet is maximum 2 lines with a normal length each. And I don't really know, how he converts double to boolean and whzy.
     
  6. Offline

    Zombie_Striker

    @GamerzKing
    In case you're interest in what @mcdorli has to say:
    http://wiki.vg/Protocol#Particle

    The only thing is, you would need a way to make sure the colors are correct. It should be a simple thing to convert potion effect/block braking colors to RGB, but it will take some time (and some testing).

    @mcdorli Most likely it's something simular to
    if (int > 256)
    return true;
    return false;
     
  7. Offline

    567legodude

    That class uses an OrdinaryColor to color the particles. It's very easy to create it.
    Code:
    new OrdinaryColor(int red, int green, int blue);
    // or
    new OrdinaryColor(Color color);
    // from org.bukkit.Color
    You could either use the Color one to get colors directly or use RGB.
    Remember in RGB each value ranges from 0 to 255.
    Where (0, 0, 0) is black and (255, 255, 255) is white.
    You can use a tool online or in most photo editing software to find the RGB value you want.
     
  8. Offline

    mcdorli

    yeah, overcomplicating things is always awesome. I just checked the source code, and it is exactly what you thought.
     
    Zombie_Striker likes this.
  9. Offline

    Zombie_Striker

    I also would just like to note that class has nestled classes. Why would anyone think that's a good idea?
     
  10. Offline

    mcdorli

    I think this is not the best library for particles. And it's really easy to create particles yourself.
    And just to help you, here is what the constructor need to look like. The only downside is that xou need to find out the constructor of most of the things (because apparently, this is not a help by any meaning)
     
  11. Offline

    567legodude

    Yeah this one isn't so good. There is a much better one made by inventivetalent on Spigot.
     
  12. Offline

    GamerzKing

    Solved, marking now. Sorry for not being specific, what I meant was to make the mobSpelt rainbow, but from what I learned, that if the particle has a speed of 0, it turns black, so I just set it to 1. Thanks anyways guys.
     
Thread Status:
Not open for further replies.

Share This Page