Library [1.8] ParticleEffect v1.7

Discussion in 'Resources' started by DarkBladee12, Jun 20, 2013.

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

    97WaterPolo

    Accyrsed
    Sure, so here is a basic example off the top of my head.

    I assume you would want to do it off an event or command, but here is what I use.

    Code:java
    1. int totaltime = 20 * 30; //30 is the amount of seconds it is to last.
    2. BukkitScheduler scheduler = Bukkit.getServer().getScheduler(); //Creates a scheduler variable
    3. final int particle = scheduler.scheduleSyncRepeatingTask(this, new Runnable()
    4. {
    5. @Override
    6. public void run() {
    7. //Play the particle here
    8. }
    9. }, 0, 1L); //Replays the particle every tick
    10. scheduler.scheduleSyncDelayedTask(this, new Runnable()
    11. {
    12. @Override
    13. public void run()
    14. {
    15. Bukkit.getScheduler().cancelTask(particle);
    16. }
    17. }, totaltime); //Cancels the replaying particle after totaltime, the int defined above.
     
  2. Offline

    Quasindro

    Hey, it's really cool, thanks!
    But as I was playing around with arguments, I noticed one thing. Either I messed something up, or the particles have a REALLY big radius. Is there a way to change it?

    This question might've been posted before, I didn't the whole thread. Sorry~ ^^

    /NVM, I apparently wasn't playing around enough. I didn't use the float number.
     
  3. Offline

    DarkBladee12

    Quasindro well the float numbers are the offset values which determine the spread of the particles^^
     
    Quasindro likes this.
  4. Offline

    Accyrsed

    97WaterPolo Thank you so much! I will look into this as soon as I can.
     
  5. Offline

    ItsLeoFTW

    An easy way to make the particles not disappear like Hypixel did would be to use a scheduler, and make it repeat every second. That way, the particles will never disappear, since they will keep being created.
     
  6. Offline

    97WaterPolo

    Accyrsed
    Sounds good, run into any problems feel free to let me know.
     
  7. Offline

    Accyrsed

    ItsLeoFTW I'm actually trying to get particles to act as animated systems. What I mean is, I want the game to cycle through a selection of particles on every tick, where some particles may be in entirely different locations. What I don't get is how to delete the previous frame's particles, since, to my knowledge, after they are spawned, they take on gravity and require several seconds to despawn. Is there a chance you could link me to a video that contains a visual of Hypixel's particles (not an explanation of them, just a video in which they show up) or let me know which map(s) they are on? Thank you!

    97WaterPolo I actually did hit an issue. Placing the scheduled task into a listener class extending JavaPlugin throws an error in the console (although in Eclipse it looks fine), and failing to have the listener extend JavaPlugin marks it as a fatal error in Eclipse, stating that the class is not a plugin. Is there a particular location in which this should be placed? Sorry, I am relatively unfamiliar with delayed tasks; on the other hand, I am used to ActionListener timers. I did attempt to look it up online, but I was unable to succeed (I maybe did not look up the correct thing). Thank you!
     
  8. Offline

    97WaterPolo

    Accyrsed
    No problem, you can NOT have two classes that extends your JavaPlugin. You need to pass a contrcutor to your Listener class, so it would be something like

    Code:java
    1. package [YOUR PACKAGE];
    2. import org.bukkit.event.Listener;
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class ActionListeners implements Listener {
    6.  
    7. public Main plugin;//Main is the name of the class that extends your Java Plugin
    8. public ActionListener(Main plugin){//ActionListener = This class name, and Main is the name of the class that extends your JavaPlugin
    9. this.plugin = plugin;
    10. }
    11.  
    12. //Then do your code down here
    13.  
    14. }
     
  9. Offline

    Accyrsed

    97WaterPolo Oh, okay, thanks! I would have never guessed that; I had assumed that a delayed task worked like a timed ActionListener. (Though, both make use of ActionListener.)
     
    97WaterPolo likes this.
  10. Offline

    BungeeTheCookie

    DarkBladee12
    Do you have a version that works with 1.6.4?
     
  11. Offline

    DarkBladee12

  12. Offline

    BungeeTheCookie

    DarkBladee12 likes this.
  13. Offline

    BungeeTheCookie

    DarkBladee12
    I was just wondering if the ReflectionUtil class for 1.7 was compatible with ParticleEffect 1.6. Otherwise, could you upload the ReflectionUtil/Handler Class aswell? Thanks!
     
  14. Offline

    DarkBladee12

    BungeeTheCookie Yes it is, because it doesn't contain anything version specific except the packet type class which is not used in the 1.6 version ;)
     
    BungeeTheCookie likes this.
  15. Offline

    BungeeTheCookie

    Thank Chu!!!
     
  16. Offline

    djyee

    Code:
    [19:58:05 INFO]: djyee issued server command: /djyee
    [19:58:05 WARN]: java.lang.ClassNotFoundException: org.bukkit.craftbukkit.v1_7_R
    3.ent²ty.CraftPlayer
    [19:58:05 WARN]:        at org.bukkit.plugin.java.PluginClassLoader.findClass(Pl
    uginClassLoader.java:67)
    [19:58:05 WARN]:        at org.bukkit.plugin.java.PluginClassLoader.findClass(Pl
    uginClassLoader.java:62)
    [19:58:05 WARN]:        at java.lang.ClassLoader.loadClass(Unknown Source)
    [19:58:05 WARN]:        at java.lang.ClassLoader.loadClass(Unknown Source)
    [19:58:05 WARN]:        at java.lang.Class.forName0(Native Method)
    [19:58:05 WARN]:        at java.lang.Class.forName(Unknown Source)
    [19:58:05 WARN]:        at net._blackcraft.ReflectionHandler.getClass(Reflection
    Handler.java:32)
    [19:58:05 WARN]:        at net._blackcraft.ReflectionHandler.getMethod(Reflectio
    nHandler.java:76)
    [19:58:05 WARN]:        at net._blackcraft.ParticleEffect.<clinit>(ParticleEffec
    t.java:222)
    [19:58:05 WARN]:        at net._blackcraft.djyee.onCommand(djyee.java:48)
    [19:58:05 WARN]:        at org.bukkit.command.PluginCommand.execute(PluginComman
    d.java:44)
    [19:58:05 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCo
    mmandMap.java:180)
    [19:58:05 WARN]:        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCo
    mmand(CraftServer.java:696)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.PlayerConnection.handleC
    ommand(PlayerConnection.java:953)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.PlayerConnection.a(Playe
    rConnection.java:815)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(Packe
    tPlayInChat.java:28)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(
    PacketPlayInChat.java:47)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.NetworkManager.a(Network
    Manager.java:148)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.ServerConnection.c(Sourc
    eFile:134)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.v(Minecr
    aftServer.java:667)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.DedicatedServer.v(Dedica
    tedServer.java:260)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.u(Minecr
    aftServer.java:558)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.MinecraftServer.run(Mine
    craftServer.java:469)
    [19:58:05 WARN]:        at net.minecraft.server.v1_7_R3.ThreadServerApplication.
    run(SourceFile:628)
    [19:58:05 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'djye
    e' in plugin Djyeecoklueklenti v1.6.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    0) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServe
    r.java:696) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.PlayerConnection.handleCommand(PlayerCon
    nection.java:953) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java
    :815) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(PacketPlayInChat.java
    :28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(PacketPlayInChat
    .java:47) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:148
    ) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craf
    tbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    67) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
    Caused by: net._blackcraft.ParticleEffect$PacketSendingException: Failed to send
    a packet to player 'djyee'
            at net._blackcraft.ParticleEffect.sendPacket(ParticleEffect.java:360) ~[
    ?:?]
            at net._blackcraft.ParticleEffect.sendPacket(ParticleEffect.java:374) ~[
    ?:?]
            at net._blackcraft.ParticleEffect.display(ParticleEffect.java:412) ~[?:?
    ]
            at net._blackcraft.ParticleEffect.display(ParticleEffect.java:428) ~[?:?
    ]
            at net._blackcraft.djyee.onCommand(djyee.java:48) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            ... 13 more
    Caused by: java.lang.NullPointerException
            at net._blackcraft.ParticleEffect.sendPacket(ParticleEffect.java:358) ~[
    ?:?]
            at net._blackcraft.ParticleEffect.sendPacket(ParticleEffect.java:374) ~[
    ?:?]
            at net._blackcraft.ParticleEffect.display(ParticleEffect.java:412) ~[?:?
    ]
            at net._blackcraft.ParticleEffect.display(ParticleEffect.java:428) ~[?:?
    ]
            at net._blackcraft.djyee.onCommand(djyee.java:48) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.3-16-g46c2c64-b3044jnks]
            ... 13 more
    
    What's wrong with this code?

    Code:java
    1. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    2. if(label.equalsIgnoreCase("djyee")) {
    3. Player player = (Player) sender;
    4. ParticleEffect.RED_DUST.display(player.getLocation(), 1.0F, 1.0F, 1.0F, 1.0F, 50);
    5.  
     
  17. Offline

    97WaterPolo

    djyee
    You might be missing some brackets, but i doubt that is it. Is your download on this resource up to date? What is line 48 of your djyee class? That seems to be throwing the error.
     
  18. Offline

    DatCookiez

    DarkBladee12 , just wondering why this doesn't work?

    I've imported the big lot of code on the first page and I have this:
    Code:java
    1. ParticleEffect.ANGRY_VILLAGER.play(p.getLocation(), 0, 0, 0, 1, 1);
    2.  

    And each time I call this code it sends this to my console:
    Code:
    [21:55:05 WARN]: [ParticleEffect] Failed to create a particle packet!
    
     
  19. Offline

    97WaterPolo

    DatCookiez
    Is there an error? I am not sure but aren't the first3 numbers floats, so shouldn't it have the "0F" instead of just 0?
     
  20. Offline

    DarkBladee12

    DatCookiez Did you copy the right ParticleEffect version? As you may have noticed there's a version for Minecraft 1.7 and higher and one for 1.6 and lower! The code you've posted looks right as far as I can see.

    97WaterPolo There's no error, only this note since the class catches Exceptions and doesn't print them. It doesn't make a difference if you write 0F or just 0 here ;)

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

    akabarblake

    Thanks, this is very helpful. I wish bukkit had this automatically.
     
    LCastr0 likes this.
  22. Offline

    DarkBladee12

    akabarblake yeah this would be cool! Someone actually made a pull request on GitHub for that here, I hope it gets accepted soon ;)
     
  23. Offline

    Likaos

    Nice,

    Question, any reason to limit the particles like explosion to 16 ? cause they can be displayed more far away !
     
  24. Offline

    akabarblake

    DarkBladee12
    Oh yes, that would be good.
    Hopefully it will add a little more 'Support'
    as this:
    Code:java
    1. particleEffect.CLOUD(color, XFloat, YFloat, ZFloat, speed, amount, Lifespan, Loc, world);

    I think having the player in the () is helpful for player.getLocation so you could add + 3 Y !
    - I know i know, it has XYZ floats, but It seems to go down. If YFloat = 3 it would start as 3 and go into the ground in 2-1 secs. I may report this, In fact, I will! [sheep]
    EDIT: I didn't know you were the coder. I just reported it to you in that message :p
     
  25. Offline

    LCastr0

    It's a Minecraft limit, not plugin limit
     
  26. Offline

    Likaos

    I know about the client limit, but for explosions it's a library limit, this particles can be sent more far away, try to change the limit to 100 and you will see, I've modified this limit for my lib (only for explosions) and that work fine.

    That's why I ask if there some other particles that could be saw from more then 16 .
     
  27. Offline

    LCastr0

    I know, I posted it already. Fireworks and Explosions particles (apparently) are the only one that works for more than 16 blocks
     
  28. Offline

    DarkBladee12

    Likaos LCastr0 Hmm I may remove the limit though since not only these particle types can be displayed with a higher range! So you can use whatever range you want ;)
     
  29. Offline

    LCastr0

    I tried changing the range, but for most of the particles, it didn't change too much, though...
     
  30. How can I get white clouds? Like when you kill the mobs. In the class it sais that is LARGE_SMOKE but it displays black clouds.
    Thx
     
Thread Status:
Not open for further replies.

Share This Page