Library EffectLib - Manage your effects the nice way. (Text/Image in Particles)

Discussion in 'Resources' started by Slikey, Apr 21, 2014.

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


    ArthurHoeke EffectManager em = new EffectManager(EffectLib.getInstance());
  2. Offline


    It should be his plugin to make it able to stop all the effects from it D: unoob ;-;
  3. Offline


    Slikey? Ich habe mega-viele Ideen für den ImageEffect. Wäre es z.B. vielleicht möglich Farben hinzuzufügen? (<Edit by Moderator: Redacted bit url>

    (Meine Idee war es ein gigantisches Schwert als Effekt zu machen, das realistisch wie ein echtes Item langsam auf der Stelle hüpft, logischerweise mit Farben oder sogar Blöcken.
    Last edited by a moderator: Feb 12, 2017
  4. Offline


    [quote uid=90881278 name="TheLexoPlexx" post=2837096]Slikey? Ich habe mega-viele Ideen für den ImageEffect. Wäre es z.B. vielleicht möglich Farben hinzuzufügen? (<Edit by Moderator: Redacted bit url>

    (Meine Idee war es ein gigantisches Schwert als Effekt zu machen, das realistisch wie ein echtes Item langsam auf der Stelle hüpft, logischerweise mit Farben oder sogar Blöcken.[/quote]

    I'm sorry, I don't speak german, but I translated it, so if you don't mind me answering in english...
    Colors aren't possible with particles, because there is a limited amount of particles (Only about 5 or 6 colors...), The moving part, I'm not sure, but I think it's already implemented.
    Last edited by a moderator: Feb 12, 2017
  5. Offline


    Oh, sorry okay. Next time I comment on English :D I forgot that you work together with slikey :D

    Short addition:
    And you want to stay with the Effects itself and you don't want to implement floating Entities (Dropped Items) right?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 29, 2015
  6. Offline


    :p I don't work together, I mostly just answer things here lol
  7. Offline


    Haha xD Okay, maybe you should make a FAQ-Thread xD

    But that still didn't answer my Question :p
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 29, 2015
  8. Offline


    The problem about those floating entities is, that i've already implemented it on Hypixel. I cannot add it to EffectLib. :/ So if anyone places a pull request, with this function, I'd add it.

    PS: I am only talking english on public conversations. Sorry ;)
  9. Offline


    Floating entities = Something like the rainbow?
  10. Offline


    Exactly ;)
  11. Offline


    Ok, might do something about it lol
  12. Offline


    Hmm awesome developers, want a challenge? Why don't you guys create an effect where the particles create a wing shape coming out from the back of the player and will follow the player wherever he moves
    iMurder and Yekllurt like this.
  13. Offline


    I want to see this happen.
  14. Offline


                    p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
                    File img = new File("plugins/testplugin", "levelup.png");
                    EffectLib lib = EffectLib.instance();
                    EffectManager em = new EffectManager(lib);
                    ImageLocationEffect effect = null;
                    try {
                        effect = new ImageLocationEffect(em, p.getLocation(), img);
                    } catch (IOException e) {
    Only plays the sound but not the effect Slikey LCastr0
  15. Offline


    Is there anything on console...?
  16. Offline


    Nope, that why I ask. Forgot to add that sorry.
  17. Offline


    I don't want to sound noobish or anything but I own a server based off of the anime "Naruto Shippuden", Is it possible to put these effects into MagicSpells. Theres a spell you can make which shoots particles and does a spell you define if it hits and this would look amazing if I only knew how to do this. Do I have to code it then export it as a jar file, then add it to plugins?
  18. Offline


  19. Offline


    I think everyone noticed how Slikey is busy these days, working on lots of things at the same time.
    Today, he 'gave me' control over the plugin. I'm sure I'll do my best to keep it as good as possible, and, for the ones who might ask, yes, he will still work on it, but not as much as he did before, because he is really busy.
    This being said, I want to announce 4 new effects, made by me:
    • CloudEffect
    • CircleEffect
    • TornadoEffect
    • ColoredImageEffect
    The last one was the most interesting one... Also, you might want to know how they work, how they look like, how you can use it, etc.
    I will do a better post explaining it tomorrow. All I can do right now is show you some images of them working:
    Tornado:,eBrVJ1K,p0Y7VJD,0ESwwZB (The cloud particle and size can be changed. The tornado particle, height and radius can also be changed.)
    Cloud:,IcU6zb8,2a0RdEn (Particles and radius can be changed)
    For the circle effect, I don't have any images right now, all I can say is that you can create a circle and make it rotate around it's own axis and also it can rotate like the cylinder, the cube, etc. It's currently 'hollow only', but might do a version of it not-hollowed.
    ColoredImageEffect: Colored version of ImageEffect. Doesn't support every color, just the ChatColors, based on codename_B util.,nYr9LU6,RTEvKLh,aHZ52CK,sRBthsQ,2UKAyGg Can read GIF's, and also can rotate. Identification of the GIF is automatic, you don't have to bother yourself into finding how to do it.
    Also, I took a little bit of time to update the ImageEffect, making it possible to use GIF's with it, and also make it rotate, just like the colored one, but in black-white.
    The Effects aren't currently in the plugin. They will be avaliable soon. What you can do now is look the source of the effects, and maybe, who knows, create your own based on it, or just use it for fun :D
    See you tomorrow, with more information and pictures! (And even some videos!)
    ChipDev likes this.
  20. Offline


    Your tornado looks better than mine, but I prefer my cloud :D
  21. Offline


    I have to admit, this is an amazing API. Fantastic work, I look forward to seeing what you add next!
  22. Offline


    Haha yeah your cloud is 'nicer'. I might do something later to correct it :p
  23. Offline


    My statement to LCastr0.
    Thank you for taking over EffectLib as Maintainer. I am sure, he will continue everything as good as I did. The new effects of LCastr0 are amazing and he deserves a big feature. I'll update the download link in the 3rd post in a few minutes.
    Currently I am studying B.Sc. Informatics and also work for Hypixel. This is the reason why I cannot offer any time to the EffectLib, what makes me really sad. I hope everyone can still use this lib for his benefits.
    When Dinnerbone updates Bukkit to 1.8, I will update the Lib to 1.8 for you, so you can rely on this piece of math. Hopefully this happens soon. If anyone is interested in porting this Plugin to Sponge, feel free to ask me about it. I will help you as good as I can.

    Thanks everyone!
    LCastr0, CraftCreeper6 and bennie3211 like this.
  24. Offline


    Inb4 LCastr0 passes it onto someone else.
    Slikey and LCastr0 like this.
  25. Offline


    I have been racking my brain trying to figure out how to properly create a zigzag line via particles.
    I know there is probably a simpleish method of doing this but I haven't been able to figure it out on my own.
    What I would like to be able to do ideally is to create a zigzag line from location A to Location B. Ideally I would like it to resemble a Saw Waveform /|/|/|/| or just a plain zigzag is fine /\/\/\/\
    Horizontial/vertical orientation would be nice too!

    The code I have come up with works exactly as desired provided I am looking straight ahead, if i look up or down the effect skews a lot. Probably because my block list includes a lot more blocks since it's straight line isn't flat.

    What I do is get a list of blocks between point A and point B, then iterate through them, adding +0.5 or -0.5 from the current block.

    I then add these blocks/locations to a second list so I have just the high and low points along the line.

    Then I again iterate through the list of high/low locations and play the effect to/from one block to the next.

    There has to be a better way to make a zigzag however my trig is poor at best, my example code below will work in a 2d world, but again aiming it up makes the effect wonky because the block list gets taller than just 1 block high.

    2. java.util.List<Block> blkline = new ArrayList<Block>();
    3. blkline = Methods.getBlocksAlongLine(location, Methods.getTargetedLocation(player, 20), player.getWorld());
    7. int zigs = blkcount / 10;
    8. int zigcount = 0;
    9. Boolean zig = true;
    10. java.util.List<Block> zigblocks = new ArrayList<Block>();
    11. java.util.List<Location> zigloc = new ArrayList<Location>();
    12. for(Block blk:blkline) //iterate over each block in the line
    13. {
    14. Block zigblock = null;
    15. int position = 0; // 0 == on line, -1 = below, +1 = above
    16. for(int i = 0;i < zigs;i++) //continue until we find the next valid block for a zig
    17. {
    18. if(zigcount >= zigs) {
    19. if(zig) {
    20. zigblock = blk.getRelative(BlockFace.UP);
    21. zigloc.add(blk.getLocation().add(0, .05, 0));
    22. zig = false;
    23. } else {
    24. zigblock = blk.getRelative(BlockFace.DOWN);
    25. zigloc.add(blk.getLocation().subtract(0, .05, 0));
    26. zig = true;
    27. }
    28. zigblocks.add(zigblock);
    29. zigcount = 0;
    30. }
    31. zigcount ++;
    32. }
    33. }
    34. Block lastorigin = zigblocks.get(0);
    35. for(int z = zigblocks.size() -1; z > 0; z--)
    36. {
    37. Block blk = zigblocks.get(z);
    38. if(lastorigin == blk)
    39. continue;
    40. Location oloc = lastorigin.getLocation();
    41. Location tloc = blk.getLocation();
    42. lastorigin = blk;
    43. LineEffect effect2 = new LineEffect(plugin.getEM());
    44. effect2.setLocation(oloc);
    45. effect2.setTarget(tloc);
    46. effect2.particle = ParticleEffect.CRIT;
    47. effect2.iterations = 5;
    48. effect2.start();
    49. }

    Sooo if anyone can come up with a better way to do this, I would like to be able to specify a few things.

    Start/End Location
    Height of the peak(s)
    Number of peaks(s)
    Rotation? Horiz or Vertical (how the zig/zags go) the effect should always be aimed at the end loc.

    Thanks in advance!

    EDIT: I have revised my method of doing this... To just use vectors instead of a block iteration..
    My idea was to take Point A - Point B to get the direction vector.
    Then break the direction up into say 10 points
    so if the distance between A and B was 20 blocks.. every 2 blocks I should get a zig or zag..
    Then I would take my start point.. Point A and do:
    Point A + (ax + 2) + (ay+ 1) + (az +2) *see code* which should give me a point 2 blocks ahead, and 1 block up....

    I did this to create a list of locations, then tried to aim a line from location to location... I wasn't seeing any particles so I had my code teleport me to the first point in the list.

    The first point in the list was WAY far away from my original origin.. and I never could see the particles jumping to the next location... So something about my math is off.

    2. Location ploc = player.getLocation();
    3. Location bloc = Methods.getTargetedLocation(player, 20);
    5. Vector from = new Vector(ploc.getX(), ploc.getY(), ploc.getZ());
    6. Vector to = new Vector(bloc.getX(), bloc.getY(), bloc.getZ());
    7. Vector direction = to.subtract(from);
    8. double vlen = direction.length();
    9. java.util.List<Location> loclist = new ArrayList<Location>();
    10. boolean zig = true;
    11. Location lastloc = ploc;
    12. int steps = 10;
    13. Vector d = direction.clone();
    14. d.normalize();
    15. for(int i = 0; i < steps; i++)
    16. {
    17. Vector up = new Vector (d.getX()+.2,d.getZ()+.2,d.getY()+.1);
    18. Vector dn = new Vector (d.getX()+.2,d.getZ()+.2,d.getY()-.1);
    20. if(zig) {
    21. d.add(up);
    22. zig = false;
    23. } else {
    24. d.add(dn);
    25. zig = true;
    26. }
    27. loclist.add(d.toLocation(player.getWorld()));
    29. }
    31. Location lastorigin = loclist.get(0);
    32. //player.teleport(lastorigin);
    33. player.sendMessage("Loclist has a size of: "+ loclist.size());
    34. for(int z = loclist.size() -1; z > 0; z--)
    35. {
    36. Location loc = loclist.get(z);
    37. if(lastorigin == loc)
    38. continue;
    39. Location oloc = lastorigin;
    40. Location tloc = loc;
    42. lastorigin = loc;
    43. LineEffect2 effect2 = new LineEffect2(plugin.getEM());
    44. effect2.setLocation(oloc);
    45. effect2.setTarget(tloc);
    46. effect2.particle = ParticleEffect.CRIT;
    47. //effect2.iterations = 5;
    48. effect2.start();
    49. }
    51. }

    Vectors annoy me, wish I didn't suck at Trig. When i can catch the particles working they seem to just head off in a line up at an angle not ending up where i originally aimed.
  26. Offline


    First, thanks for replying. Second, nice idea! I might see a way to implement it in the current line effect. As for your second example, you created a vector using x,z,y. A vector should be created using x,y,z. Probably that is why it didn't work :p
  27. Offline


    Thanks for the tip, it seems that I received some conflicting info. Although I do see where I was doing it two different ways in two different parts of the code... I have edited my code which does create a zigzag although currently it always creates it the same direction regardless of my pitch and yaw... I feel like converting the vector to a location then adding the pitch and yaw to it should fix that but adding the yaw / pitch does not seem to alter the angle/rotation of the effect at all. It always points due east..

    1. Location ploc = player.getLocation(); //Player Location (origin of efx)
    2. Location bloc = Methods.getTargetedLocation(player, 20); //Target Location (endpoint of efx)
    4. Vector from = new Vector(ploc.getX(), ploc.getY(), ploc.getZ()); //Get the first point from our start
    5. Vector to = new Vector(bloc.getX(), bloc.getY(), bloc.getZ()); //Get the last point from our target
    6. Vector direction = to.subtract(from); //Used to find the length of the vector
    7. double vlen = direction.length(); //Vector's length.
    8. java.util.List<Location> loclist = new ArrayList<Location>(); //Create a list to store the points.
    9. boolean zig = true; //Just used to alternate the peak either up or down
    10. Location lastloc = ploc; //Keep track of where our last location was.
    11. int steps = 10; //Number of times we should zig/zag
    12. Vector d = from.clone(); //make a copy of or orgin to work with
    13. Float pitch = ploc.getPitch(); //Get the pitch from the start point
    14. Float yaw = ploc.getYaw(); //Get the yaw from the start point
    15. double steplen = vlen / steps; //Get how much we should add between points.
    17. for(int i = 0; i < steps; i++) //make a list of the points along our line.
    18. {
    20. //d.normalize(); //not using currently
    22. Vector up = new Vector (0,.85,0); //add 0.85 to the height (make settable via a variable later)
    23. up.toLocation(player.getWorld(), yaw, pitch); //Convert it to a location to set the pitch and yaw?
    24. Vector dn = new Vector (0,-.85,0); //subtract 0.85 from the height(make settable via a variable later)
    25. dn.toLocation(player.getWorld(), yaw, pitch);//Convert it to a location to set the pitch and yaw?
    27. if(zig) { //figure out if we should go up or down..
    28. d.add(up); //add our UP vector to the d vector
    29. zig = false; //next time it should go down.
    30. } else {
    31. d.add(dn); //add our DN vector (with a -y) to the d vector.
    32. zig = true; //next time it should go up.
    33. }
    34. d.setX(d.getX() + steplen); //add the steplen variable to our vectors X
    35. d.setZ(d.getZ() + steplen); //add the steplen variable to our vectors Z
    37. loclist.add(d.toLocation(player.getWorld(), yaw, pitch)); //Add the finalized vector to the location list
    38. player.sendMessage("Adding Point X: " + d.getX() + " Y: " + d.getY() + " Z: " + d.getZ() + " Pitch: " +pitch + " Yaw: " + yaw);
    40. }
    42. Location lastorigin = loclist.get(loclist.size()-1); //grab the last vector in the list (which should be the origin point)
    44. for(int z = loclist.size() -1; z > 0; z--) //loop through each point in our location list.
    45. {
    46. Location loc = loclist.get(z); //store the endpoint location from the list in a variable.
    47. if(lastorigin == loc) //make sure the 2 points are distinct
    48. continue;
    49. Location oloc = lastorigin; //start point (of the peak)
    50. Location tloc = loc; //end point (of the peak)
    52. lastorigin = loc; //move the endpoint to the start point for the next iteration
    53. LineEffect effect2 = new LineEffect(plugin.getEM()); //set up a line effect
    54. effect2.setLocation(oloc); //line start point
    55. effect2.setTarget(tloc); //line end point
    56. effect2.particle = ParticleEffect.CRIT;
    57. effect2.start(); //start the effect
    58. }

    *EDIT* If this were done inside an effect I feel like it would be much more efficient. Right now I am doing all of this outside of effectlib and spawning a new line effect per each segment of the zigzag line. Perhaps someone can convert this to an effectlib effect?
  28. Offline


    Here are all the new effects, in a video, that is better than images...
    Also, new effect: DiscoBall (Idea by coco5843).

    • Make it rain or snow!
    • You can change the particle from the cloud and the rain/snow
    • You can change the radius of the rain and the cloud
    • Create a pretty tornado!
    • You can change the height, particle and radius of the tornado
    • You can also make it not display the cloud under the tornado
    • You can change the particle and the radius of the cloud
    • Creates a circle that rotates!
    • You can change the particle and radius of the circle
    • Display Colored images!
    • Works just as the ImageEffect (now updated, supporting gifs in black-white), but with some colors (You can only use the same as ChatColors, sadly)
    • You can change the plane of rotation (X, Y, Z, XY, XZ, XYZ, YZ), and if it will rotate or not
    • Displays gifs!
    • Create a 'party' with few commands!
    • You can change the sphere particle, the 'laser' particle, the max number of lines per iteration, the max size of the lines and the radius of the sphere!
    • You can also change the direction that it will display the laser (UP, DOWN or BOTH)
    Wruczek and dNiym like this.
  29. Offline


    Amazing ! amazing work ! you're great man !
    LCastr0 likes this.
  30. Offline


    Can you use holographic displays api to make those particle effects so people on every side can see it and can you give me an example of it because i want it to first start off so a magic crit gets shoot out upwards into the sky and then the Holographic particle effect shows for at least 5 seconds before it goes away. I am making a Spells plugin for myself so i can play around with it and i was wondering if you could do something like that because that is going to be one of my spells.
    LCastr0 Slikey

    Note: Tag me so i know you are replying to me.
Thread Status:
Not open for further replies.

Share This Page