Library [1.8] ParticleEffect v1.7

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

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


  2. Offline


    All my normal particles work, but when I try to do a colorable one, I get "OrdinaryColor cannot be resolved to a type", any ideas how I can fix this?

  3. Offline


    Hmm this is strange, did you copy the latest version of the class?
  4. Offline


    @DarkBladee12 Yes I did have the latest, I got it fixed by importing it manually in my IDE ;)

    How would I display a colorable effect with an offset?
    I already tried
    2. ParticleEffect.REDSTONE.display(new OrdinaryColor(0,0,0), 0.3f, 0.3F, 0.3F, 0.0001F, 25, snowball.getLocation(), p);

    However, the arguments aren't correct.

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


    It's not possible to display these colorable effects with an offset since the rgb values are used as offset values instead. However you can use the normal display method without the ParticleColor parameter to have an offset.
  6. How to display Block Crack of for example: stone.
  7. Offline


    This is how you'd display this effect:
    Player player = Bukkit.getPlayer("Urag");
    int amount = 20;
    ParticleEffect.BLOCK_CRACK.display(new BlockData(Material.STONE, (byte) 0), 1F, 1F, 1F, 1F, amount, player.getLocation(), 30);
    Urag likes this.
  8. @DarkBladee12
    How to display:
    - Block Crack of Pink Wool?
    - smoke from brewing stands?
  9. Offline


    For pink wool use this block data: new BlockData(Material.WOOL, (byte) 6);
    For the brewing stand smoke use:
    Player player = Bukkit.getPlayer("Urag");
    int amount = 20;
    ParticleEffect.SMOKE_NORMAL.display(1F, 1F, 1F, 1F, amount, player.getLocation(), 30);
    Urag likes this.
  10. @DarkBladee12
    What about colors of notes?

    Sorry, it is in the tutorial. ;)

    But how to use NoteColor? :p

    Ok, I know.
    Last edited: Aug 9, 2015
  11. How would you stop a particle when the player leaves? This is my code:

    public void onJoin(PlayerJoinEvent e) {
    final Player p = e.getPlayer();Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    public void run() {

    ParticleEffect.HEART.display(50, 50, 0, 0, 0, p.getLocation().add(0, 1, 0), 50);}
    }, 0, 1);
  12. Offline


    You could just store the scheduler id along with the player uuid in a HashMap and check at the PlayerQuitEvent if the map contains the uuid of the player who logged out and cancel the scheduler by id.
  13. Offline


    Nice, would look forward to using this if I need it.
    Last edited: Sep 13, 2015
  14. Offline


    Is it compatible with Cauldron?
  15. @DarkBladee12 I'm currently writing a plugin in Scala (really awesome language that compiles into Java bytecode). I plan to use this library in the plugin, so I'd like to rewrite it in Scala. I'll still keep the disclaimer there. Hopefully that's ok with you ;)
  16. Offline


    Yes that's totally fine! You can also publish it if you want, maybe as a help for others who use Scala.

    I don't know if this works with Cauldron. I couldn't get it to run on my testserver so I'm not aware of that. Just try it out yourself by coding a simple testing plugin or using my ParticleDemo plugin.
  17. Awesome. I'm currently redoing the ReflectionUtils class, and I've found out that enumerations in this language are not very elegant as you can see here :p At lease those methods look much nicer.

    EDIT: What's the point of getPath() in PackageType? I don't see where it's used at all.
    Last edited: Sep 16, 2015
  18. Offline


    Well the getPath method isn't used in any classes, it's just there as a getter for the path variable in case someone needs that.
  19. Ah, right. I don't see much of a reason to need it, though. I should be able to safely drop it, as it's a little tricky to implement in this language due to the funnyness of enumerations.

    EDIT: Nevermind, I can implement that easy.

    EDIT 2: I don't even need that anymore. I can just do PackageType.CRAFTBUKKIT_HELP.path and it'll return "help". Power of Scala B)
    Last edited: Sep 17, 2015
  20. Offline



    For Build #12 you forgot the plugin.yml

    [11:15:47 ERROR]: Could not load 'plugins/particleeffect-1.7.0-SNAPSHOT.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at ~[-1.8.7-.jar:git-Spigot-6d16e64-b105298]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins( [-1.8.7-AlphaDwD.jar:git--6d16e64-b105298]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins( [-1.8.7-AlphaDwD.jar:git--6d16e64-b105298]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init( [-1.8.7-AlphaDwD.jar:git--6d16e64-b105298]
        at [-1.8.7-AlphaDwD.jar:git--6d16e64-b105298]
        at [?:1.8.0_60]
    Caused by: Jar does not contain plugin.yml
        ... 6 more
  21. Offline


    ParticleEffect is just a library and not a functional plugin, therefore it doesn't have a plugin.yml! If you're not using Maven you have to copy the ParticleEffect class and ReflectionUtils class into your project. Otherwise you have to enable the shade plugin by copying the following into your plugins section (<plugins>...</plugins>) in the pom.xml:
    madmac likes this.
  22. Offline

    andrew chi

    Any chance you make make it so we can make a particle packet once, then use it infinitely? ATM, creating a new packet for every particle is too intensive, as I'm making a spell based game.
  23. @DarkBladee12
    Any reason as to why initialize() in ParticlePacket is public and static? I don't see it being accesses anywhere outside the ParticlePacket class.

    @andrew chi
    I haven't tried this, but try creating a new ParticlePacket, and invoke sendTo(Location center, Player player), sendTo(Location center, Player[] players) or sendTo(Location center, double range) on it. The one you choose depends on if you want it to only be visible to one player (1st option), only some players (2nd option), or all players in a specified range (3rd option).

    // Creating the packet
    ParticlePacket packet = new ParticlePacket(ParticleEffect.SLIME, new Vector(0.0, 0.0, 0.0), 1.0F, false, null)
    // Sending the packet
    packet.sendTo(location, player) // location is of type Location, player is of type Player
    packet.sendTo(location, players) // location is of type Location, players is of type Player[]
    packet.sendTo(location, range) // location is of type Location, range is of type double
    Last edited: Sep 18, 2015
  24. Offline

    andrew chi

    Unfortunately, this only works if the particle is sent to the exact same location, making it rather useless... :/

    Sort of found the issue, but I don't quite know how to fix this. So the ParticlePacket is just an object with some random strings. There is, however, an instantiate function, which uses reflection, which causes it to be rather slow. Is there, by any chance, that you can add a function that can further alter a crafted packet's location? Thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 29, 2015
  25. It shouldn't be too hard. I'll see if it's possible once I finish porting the library over to Scala (which is nearly done, only got the display methods to go), then make a pull request if it works.
    Last edited: Sep 20, 2015
  26. Offline


    Thank you for the info, I just ended up adding in the classes to my plugin.
  27. Offline


    @andrew chi
    I can add some setter methods for the ParticlePacket class. However they still have to use reflection in order to update the value in the packet instance!
  28. Offline



    Hey man, why can't other players see the particles? Only I can see them. And if they do the event they can only see their own nobody else can see each others. Why? Anyway to fix this?

    Location loc = p.getLocation();
    ParticleEffect.FLAME.display(0.0F, 0.0F, 0.0F, 0.3F, 3, loc, 1.0D);
  29. @file10
    You set the range to 1 block
  30. Offline


    Yeah, I found that out after I asked you guys. But thanks anways :D
Thread Status:
Not open for further replies.

Share This Page