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

    HeavyMine13

    aka laggy thing.
     
  2. Offline

    LCastr0

    Uh... Needs a skin? If not, ot would be 6 cubes in dfferent locations... But yeah, laggy.
     
  3. Offline

    ChipDev

    Yes, very laggy :p
     
  4. Offline

    LCastr0

    Coming Soon
    New Effect: AnimatedBallEntityEffect​
    • Custom ParticleEffect
    • Custom number of particles
    • Custom number of particles per iteration
    • Custom size (horizontal)
    • Custom factors (Sizes of X, Y and Z)
    • Custom offsets (X, Y and Z)
    • Custom rotation (X, Y and Z)
    Description: Creates a "ball" around the entity, that goes up and down in a sequence​
    Author: Qukie
    Screenshots:
    Screenshots (open)
    Screenshots (open)

    [​IMG]
    [​IMG]
    [​IMG]
    Video (Made by him):
    Source: Click Here

    I'll update the post when it's released
     
    NathanG_ and skyrimfan1 like this.
  5. Offline

    iMurder

    LCastr0
    AnimatedBallEntityEffect.. is.. just amazing.....
     
  6. Offline

    LCastr0

    Haha don't tahg only me, tahg the author too!
    Qukie :D
     
    iMurder likes this.
  7. Offline

    JavaSource

    I need help with my code the vortex effect only goes one way but I need it to go up Heres a link to my code plox help.
    http://pastebin.com/PEe6WtJ4
     
  8. Offline

    Slikey

    Don't call Player.getLocation that often. every call for .getLocation instantiates a new object of Location.

    Code:java
    1. Location loc = new Location(event.getPlayer().getWorld()
    2. , event.getPlayer().getLocation().getX()
    3. , event.getPlayer().getLocation().getY() + 2
    4. , event.getPlayer().getLocation().getZ());


    Also you don't carry the pitch and yaw of the player's view.

    Try this.
    Code:java
    1. Location loc = event.getPlayer().getLocation().add(0, 2, 0);
     
  9. Offline

    JavaSource

    thank you so much <3 amazing work btw so many posibilities
     
  10. Offline

    ChipDev

    LCastr0
    Why entity not location..?
    Does me have permission to change..?
    Show Spoiler
    [​IMG]

    Code:java
    1. package de.slikey.effectlib.effect;
    2.  
    3. import de.slikey.effectlib.EffectManager;
    4. import de.slikey.effectlib.util.MathUtils;
    5. import de.slikey.effectlib.util.ParticleEffect;
    6. import de.slikey.effectlib.util.VectorUtils;
    7. import org.bukkit.Location;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.util.Vector;
    10.  
    11. /**
    12. * Creates an animated Sphere.. Thanks to the author for sharing it!
    13. * [media=youtube]RUjIw_RprRw[/media]
    14. * @author <a href="[url]http://forums.bukkit.org/members/qukie.90952701/[/url]">Qukie</a>
    15. */
    16. public class AnimatedBallLocationEffect extends EntityEffect {
    17.  
    18. /**
    19.   * ParticleType of spawned particle
    20.   */
    21. public ParticleEffect particle = ParticleEffect.WITCH_MAGIC;
    22.  
    23. /**
    24.   * Ball particles total (150)
    25.   */
    26. public int particles = 150;
    27.  
    28. /**
    29.   * The amount of particles, displayed in one iteration (10)
    30.   */
    31. public int particlesPerIteration = 10;
    32.  
    33. /**
    34.   * Size of this ball (1)
    35.   */
    36. public float size = 1F;
    37.  
    38. /**
    39.   * Factors (1, 2, 1)
    40.   */
    41. public float xFactor = 1F, yFactor = 2F, zFactor = 1F;
    42.  
    43. /**
    44.   * Offsets (0, 0.8, 0)
    45.   */
    46. public float xOffset, yOffset = 0.8F, zOffset;
    47.  
    48. /**
    49.   * Rotation of the ball.
    50.   */
    51. public double xRotation, yRotation, zRotation = 0;
    52.  
    53. /**
    54.   * Internal Counter
    55.   */
    56. protected int step;
    57.  
    58. public AnimatedBallPlayerEffect(EffectManager effectManager, Location location) {
    59. super(effectManager, location);
    60. this.type = EffectType.REPEATING;
    61. this.iterations = Integer.MAX_VALUE -1;
    62. this.period = 1;
    63. }
    64.  
    65. @Override
    66. public void onRun() {
    67. Vector vector = new Vector();
    68. for (int i = 0; i < particlesPerIteration; i++) {
    69. step++;
    70.  
    71. float t = (MathUtils.PI / particles) * step;
    72. float r = MathUtils.sin(t) * size;
    73. float s = 2 * MathUtils.PI * t;
    74.  
    75. vector.setX(xFactor * r * MathUtils.cos(s) + xOffset);
    76. vector.setZ(zFactor * r * MathUtils.sin(s) + zOffset);
    77. vector.setY(yFactor * size * MathUtils.cos(t) + yOffset);
    78.  
    79. VectorUtils.rotateVector(vector, xRotation, yRotation, zRotation);
    80.  
    81. particle.display(location.add(vector), visibleRange, 0, 0, 0, 0, 0);
    82. location.subtract(vector);
    83. }
    84. }
    85.  
    86. }

    oh yea :)
     
  11. Offline

    LCastr0

    You can create your own effects, and I guess its all good editing that one
     
  12. Offline

    Slikey

    You are always allowed to alter, change or add effects. THat's what MIT License is for :3
     
  13. Offline

    rcth

    I have two questions about the DragonLocationEffect:
    1) How can I change the direction? There is no yaw option.
    2) I can't seem to get effect.visibleRange to work.
    PHP:
    DragonLocationEffect effect = new DragonLocationEffect(plugin.effectManagerloc);
    effect.length length;
    effect.iterations duration 20;
    effect.visibleRange 100;
    effect.start();
    I first used 30 as range, and changed that to 100 for a test, but still you need to stay very close for the effect to be noticed.
     
  14. Offline

    SoThatsIt

    rcth visible range will only work on particles which dont have a range limit on the client side. for example the witch magic particle is limited on the client to only be able to be seen within 30 blocks but the firework particle doesnt have a client side limit. So you can use the visible range if you are using firework particles and you want them to be seen from far away or only when close up.
     
  15. Offline

    LCastr0

    For the visible range question, SoThatsIt answered.
    For the yaw, it is get by the location's yaw, so you will have to change the location yaw before starting the effect.
     
  16. Offline

    rcth

    Thanks guys, got it fixed!

    And a small question: The particles do spread a lot at the end (arches). Is it possible to keep them more together?

    [​IMG]
    They spread out too much for the best effect.
     
  17. Offline

    LCastr0

    Change the pitch to something like .05f
     
  18. Offline

    ChipDev

    Why a float..?
     
  19. Offline

    LCastr0

  20. Offline

    ChipDev

    What I think when I read that.
    "You, I see that my videos are better than yours. My trick is to approach the particles and move away."
     
  21. Offline

    LCastr0

    Good and bad news for 1.8!
    Good - Particle renders no longer bug with liquids, non-solid blocks and transparent blocks!
    Bad - Spectator mode displays particles horizontally. (More info: )
     
    Goblom and DarkBladee12 like this.
  22. Offline

    Pr07o7yp3

    I want to make line effect from player to about 10-15 radius of his direction.
    So.
    LineEffect lineEffect = new LineEffect(effectManager);
    lineEffect.setLocation(player.getLocation());
    lineEffect.setTarget(?);
    lineEffect.start();

    I tried with player.getLocation().getDirection().multiple(10) but without success. :(
     
  23. Offline

    chasechocolate

    Pr07o7yp3 store player.getLocation() in a variable, and then use loc.add(loc.getDirection().normalize().multiply(10)), I think
     
    Pr07o7yp3 likes this.
  24. Offline

    Pr07o7yp3

    Tnx man. Works perfect. :)

    Actually I have another question. Not exactly for you.
    I place 2 fountains and then I get super delay. There was no TPS drop but when I send some message in chat, server get this after few seconds. I think it's because there is some limit of packets per second. Is there any solution?
     
  25. Offline

    LCastr0

    Since one fountain already "lags" the client, because of the number of particles it's spawning at the same time, and the math involved in it, 2 fountains will surely make the server laggy, even with no TPS drop. What happens is (explained by Slikey, a while ago, not here though) that the packets are sent to the client through the server connection. If there are too many packets of particles being sent at the same time, the client will lag. The server will still be 100% working and the TPS can even be at 20, but the client will lag. Sometimes even crash...
    You can test it yourself by spawning 10000² particles at the same time on enable, in the location that the player is. It will not lag the server, but the client.
     
  26. Offline

    mkezar

    I like the plugin :) very fun. now i know where flame breath came from in arena brawl on hypixels server.... (slikey)
     
  27. Offline

    LCastr0

    Actually, the effects were made before he published the API and became a Hypixel dev. It was made, probably, by codename_B
     
  28. Getting a ConcurrentException running this code in an asynchronus task:
    Code:java
    1. /* 98 */ (isInRange2D(player.getLocation(), loc, radius) ? ParticleEffect.RED_DUST : ParticleEffect.ENCHANTMENT_TABLE).display(curloc, .1f, 0f, .1f, 0f, 10); // isInRange2d returns a boolean

    The Exception:
    Code:text
    1. org.apache.commons.lang.UnhandledException: Plugin <plugin> v0.1 generated an exception while executing task 42
    2. at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
    3. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    4. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    5. at java.lang.Thread.run(Thread.java:744)
    6. Caused by: java.util.ConcurrentModificationException
    7. at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
    8. at java.util.ArrayList$Itr.next(ArrayList.java:831)
    9. at org.bukkit.craftbukkit.v1_7_R3.CraftWorld.getPlayers(CraftWorld.java:673)
    10. at de.slikey.effectlib.util.ParticleEffect.getPlayers(ParticleEffect.java:307)
    11. at de.slikey.effectlib.util.ParticleEffect.display(ParticleEffect.java:531)
    12. at de.slikey.effectlib.util.ParticleEffect.display(ParticleEffect.java:599)
    13. at com.jofkos.towethings.test.TowerRingTestCmd.run(TowerRingTestCmd.java:98)
    14. at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftTask.run(CraftTask.java:58)
    15. at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
    16. ... 3 more
    17.  

    Can i synchronise that (how?), or should i run it in the main thread?
     
  29. Offline

    mkezar

    cool stuffz :p ive always wanted to be one of the dev :p since they need more cosmetic stuff. thats the only thing i can make xD
     
  30. Offline

    Slikey

    Do not use async tasks for other things than Database / File writing. THe entire Bukkit API is not thread-safe.
     
Thread Status:
Not open for further replies.

Share This Page