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


    You'll be forgiven. ;) I don't think that this is going to be a copy&paste Lib because of it's size. I already reached an amount of effects, which would take a long time to copy & paste. And to make it even more friendly to use, there a secure mechanism if you work with entities on the effects.
    You can spawn entities with a lifetime and they will be removed after that time. And in case the server shuts down before the expiration, the entities are remove instantly to prevent damage to the world. ;)
    This is the reason, why you have to register an EventManager when using it. Disposing this manager kills all your effects immediatly.
    Someone_Like_You likes this.
  2. Slikey Okay :), letters would be cool to add :D (just random ideas that popping in my head haha)
  3. Offline


    Someone_Like_You Yeah, I already though of this.. I have to search for a BitmapFont parser.. then it's gonna be easy with custom fonts.. Will look at it, after the DNA.
    LCastr0 and Someone_Like_You like this.
  4. Slikey [​IMG]
    Imagine its says MOTHER OF EFFECTS ;)
    Slikey likes this.
  5. Offline


    New Effect: DNA
    • Custom particles for helix, base1 and base 2
    • Custom radials per particle
    • Custom radius
    • Custom particles per step and per base
    • Custom lenght of dna-double-helix
    • Custom growth per particle
    • Custom interval between bases
    Show Spoiler

    1. import org.bukkit.Location;
    2. import org.bukkit.util.Vector;
    4. import de.slikey.effectlib.EffectManager;
    5. import de.slikey.effectlib.EffectType;
    6. import de.slikey.effectlib.util.MathUtils;
    7. import de.slikey.effectlib.util.ParticleEffect;
    8. import de.slikey.effectlib.util.VectorUtils;
    10. public class DnaLocationEffect extends LocationEffect {
    12. /**
    13.   * ParticleType of spawned particle
    14.   */
    15. public ParticleEffect particleHelix = ParticleEffect.FLAME;
    17. /**
    18.   * Particle of base 1
    19.   */
    20. public ParticleEffect particleBase1 = ParticleEffect.DRIP_LAVA;
    22. /**
    23.   * Particle of base 2
    24.   */
    25. public ParticleEffect particleBase2 = ParticleEffect.DRIP_WATER;
    27. /**
    28.   * Radials to turn per step
    29.   */
    30. public double radials = Math.PI / 90;
    32. /**
    33.   * Radius of dna-double-helix
    34.   */
    35. public float radius = 1.5f;
    37. /**
    38.   * Particles to spawn per interation
    39.   */
    40. public int particlesHelix = 30;
    42. /**
    43.   * Particles per base
    44.   */
    45. public int particlesBase = 15;
    47. /**
    48.   * Lenght of the dna-double-helix
    49.   */
    50. public float lenght = 15;
    52. /**
    53.   * Growth per particle
    54.   */
    55. public float grow = 0.05f;
    57. /**
    58.   * Particles between every base
    59.   */
    60. public float baseInterval = 20;
    62. /**
    63.   * Current step. Works as counter
    64.   */
    65. protected int step = 0;
    67. public DnaLocationEffect(EffectManager effectManager, Location location) {
    68. super(effectManager, location);
    69. type = EffectType.REPEATING;
    70. period = 1;
    71. iterations = 500;
    72. }
    74. @Override
    75. public void onRun() {
    76. for (int j = 0; j < particlesHelix; j++) {
    77. if (step * grow > lenght)
    78. step = 0;
    79. for (int i = 0; i < 2; i++) {
    80. double angle = step * radials + Math.PI * i;
    81. Vector v = new Vector(Math.cos(angle) * radius, step * grow, Math.sin(angle) * radius);
    82. drawParticle(v, particleHelix);
    83. }
    84. if (step % baseInterval == 0) {
    85. for (int i = -particlesBase; i <= particlesBase; i++) {
    86. if (i == 0)
    87. continue;
    88. ParticleEffect particle = particleBase1;
    89. if (i < 0)
    90. particle = particleBase2;
    91. double angle = step * radials;
    92. Vector v = new Vector(Math.cos(angle), 0, Math.sin(angle)).multiply(radius * i / particlesBase).setY(step * grow);
    93. drawParticle(v, particle);
    94. }
    95. }
    96. step++;
    97. }
    98. }
    100. protected void drawParticle(Vector v, ParticleEffect particle) {
    101. VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians);
    102. VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians);
    104. location.add(v);
    105. particle.display(location, visibleRange);
    106. location.subtract(v);
    107. }
    109. }

    I am going to release it in about 5 minutes..
  6. Offline


    Slikey just a tip, instead of using loc.add(v), loc.subtract(v), you can just use loc.clone().add(v). This clones the object, returning a new instance with the same x, y, z, pitch, yaw, etc. Just saves a few lines :)
  7. Offline


    chasechocolate Corrent, it saves lines. But it is move effecient to add the values and subtract them, then instantiating a new object. It is a pretty hard job for java to free up space to create a new object and collect it after use. The simple addition and subtraction is way faster.

    Get prepared for this effect!
    1. public String text = "Hello";

    And the best news.. This is easy as fuck and editable while runtime.. I think the release will be tonight! ;)

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


  9. Offline


    Nice job on all of these! You should include a default "OMG PLS DONT LAG MY CLIENT" preferred setting ;)
  10. Offline


    codename_B Thank you.. I try to do a lag free set of default settings.. But I have a pretty decent machine next to me, so I have some problems with testing lags. :D
  11. Offline


    If it even slows your machine down it's probably going to break 80% of users xD

    I've felt those feels myself too.

    Oh, my request?

    A giant rotating cube ;)

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


    codename_B I doesn't slow me down, so everything is fine here. ;) If you experience any lag, please tell me.. I am always open for feedback!

    ROFL.. I don't have a cube? Well.. I skipped that obviously.. Starting now. ;)

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


    I wonder if codename_B and Slikey work'd together to make a Particle Effects plugin... It would be so awesome... :confused:
  14. Offline


    Mine isn't awesome? :'(
    McKiller5252 and Ultimate_n00b like this.
  15. Offline


    It is!!!
    I just said if codename_B did something WITH you, would be awesome'r!

    P.S.: You're amazing! :p
  16. Offline


    LCastr0 Haha. Was just kidding you^^
  17. Offline


    Pff I knew that...
    ChipDev likes this.
  18. Offline


    codename_B Here you go.. I think i'll do the documentation tomorrow and upload the new Lib later..
    I rotates with 3 different angular velocities around x,y and z axis and is hollow inside.. particles are 100 per side for the screenshots.. build in will be 64 per side..^^

    Someone_Like_You Thank you man!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jan 4, 2016
    LCastr0 likes this.
  19. Offline


    No way...
  20. Offline


    New Effect: Cube
    • Custom edge-lenght
    • Custom angular velocity on x, y and z axis
    • Disable rotation
    • Custom particle
    Source on GitHub!
    Submit your implementations of the library per PM! I am interested! ;)
    codename_B likes this.
  21. Offline


    Amazing job with this. These are some unrealistic effects that look just spectacular in Minecraft. Keep up the good work! I also have an idea for an effect. Might be a little hard with some intense calculations, but possibly display an image using particles? Like little convert some type of Image object into particles. You could make it so that if there are colors with high contrast to eachother in the image, the particles for those colors would switch. So like if I took the Bukkit logo and put as the image, I could make the gray part be explosions, and the lava in the bucket logo being lava particles. As the functionality of setting spin/rotation, size, the particles, the amount of contrast between colors for different particles, and direction the particles will be displayed.
    Slikey likes this.
  22. Offline


    Oh man.. You just destroyed my next suprise^^ The next thing coming is an image parser, which will support black and white at the beginning... i think later there will be additional features ;) I am going to release this feature with the batman-logo.. nanananananaaaaa

    and then.. i have to care for my birthday on sunday.. :) so tomorrow maybe only one new effect :D

    Finally new Effect: Text
    Warning: Be careful with this effect. It is intensive in calculation and shouldn't be used as replacement for signs.
    • Custom Font, Size and Text!
    • Custom Particle
    • Invert the Text
    • Rotate around Y-Axix
    Source only available on GitHub because of Helper-Classes
    For a demo, see the Testplugin and type /text
    Download from my private server: Clicky

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jan 4, 2016
    ChipDev and AstramG like this.
  23. Offline


    Can't wait to see that. I'm totally going to be using this to display some information over the arenas of my minigames if this image parser looks any nice. I can't really imagine if it would look good or not in Minecraft though :p.
  24. Offline


    You might display information with the TextEffect.. i think this will be easier to use.
  25. Offline


    Yeah you're probably right. But I have a feeling that the image one might be nice too for different kinds of information. And also another idea, think you could create an effect that allows us to create our own shapes? Basically something simple that draws lines connecting the points in order, the points could be locations.
  26. Offline


    Do you have Skype?
  27. Offline


    AstramG That's a nice idea. I'll put that on the list ;)
    VictoryShot Yeah, slikeytheimbamage is my skype-tag.
  28. Offline


    Slikey Huge respect for you mate! This is such an amazing resource both feature-wise and code-wize. (Took a like at the GitHub, it's great)! Been looking for something like this for some time now considering I'm not the greatest at trigonometry. :p

    Anyway, keep up the great work! Looking forward to your future projects! Trying to think of suggestions but you have so many already and most of the effects that I could have thought of to request have already been implemented haha. xP
  29. Offline


    Very creative library.
    I love how people still release these kind of things to the public.

    I'd love to see some more entity effects.
  30. Offline


    I also think your server's internet connection is not going to like this, when having many players online this can cause you to send thousands of packets every tick.
Thread Status:
Not open for further replies.

Share This Page