Library [1.8] ParticleEffect v1.7

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

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

    DarkBladee12

    @MrDplugins
    Where's the point in allowing doubles if i have to convert the to floats anyway for creating a packet? Or what did you exactly mean?
     
  2. Offline

    MrDplugins


    Code:
    l.getX() + 0.43D, l.getY() , l.getZ() + 0.25D
    I'm using the doubles to get the area around the players head to spawn the particles at a certain spot. I solved my issue by creating a new location and using your location argument I spawn the particles there.
    Code:
                            ParticleEffect.HEART.display(0, 0, 0, 1, 1, loc1, 16);
     
  3. Offline

    DarkBladee12

    @MrDplugins
    Well you won't need doubles at all since these numbers don't have that much decimals ;)
     
  4. Offline

    PowerOfGermany

    Hey, dunno why there is a prob, maybe you could help me?
    I can't see any particles.

    Code:
            plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
                p.sendMessage("test");
                ParticleEffect.SNOWBALL.display(0.1f,0.3f,0.5f,0.4f,20,p.getLocation(),1.0);
                ParticleEffect.EXPLOSION_HUGE.display(0.1f,0.3f,0.5f,0.4f,20,p.getLocation(),1.0);
            }, 5 * 20L, 1L);
     
  5. Offline

    LCastr0

    Did you enable particles in your mc video config?
     
  6. Offline

    PowerOfGermany

    Where can I change this setting?
    Edit: Found it, will test it tomorrow. Thanks
     
  7. Offline

    iAlltonHD

    I get the error "This particle effect is not supported by your server version" when doing:

    Code:
    ParticleEffect.BLOCK_DUST.display(new OrdinaryColor(1, 1, 1), p.getLocation(), 10);
    I want to create bright red particles, as I've seen done on servers.
    Am I creating the "OrdinaryColor" wrong?


    Code:
    [18:32:03 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'test
    ' in plugin Test v1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra
    ftbukkit.jar:git-Bukkit-17962f6]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
    0) ~[craftbukkit.jar:git-Bukkit-17962f6]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServe
    r.java:624) ~[craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerCon
    nection.java:1058) [craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java
    :919) [craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(SourceFile:37) [craft
    bukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(SourceFile:9) [craftb
    ukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [cra
    ftbukkit.jar:git-Bukkit-17962f6]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
    ?:1.7.0_51]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_51]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:6
    43) [craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:2
    84) [craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:5
    98) [craftbukkit.jar:git-Bukkit-17962f6]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java
    :506) [craftbukkit.jar:git-Bukkit-17962f6]
            at java.lang.Thread.run(Unknown Source) [?:1.7.0_51]
    Caused by: net.venturianmc.MixedMadness.ParticleAPI.ParticleEffect$ParticleVersi
    onException: This particle effect is not supported by your server version
            at net.venturianmc.MixedMadness.ParticleAPI.ParticleEffect.display(Parti
    cleEffect.java:708) ~[?:?]
    Using craftbukkit 1.8.
     
    Last edited: Mar 13, 2015
  8. Offline

    PowerOfGermany

    Hey,

    I try to show the chunkborders with particles. First I tried it with glass - works.
    Now when I changed the blocks to a scheduler with particles can I only see them, if I spawn them at the player location.. Whats wrong?


    Code:
            Chunk chunk= p.getWorld().getChunkAt(p.getLocation());
    
            int yWert = p.getLocation().getBlockY();
            if (yWert >= 6) {
                yWert = yWert - 5;
            } else {
                yWert = 1;
            }
    
            int yWert2 = yWert;
    
            if (cmd.getName().equalsIgnoreCase("sc")) {
                int totaltime = 20 * 7;
                BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
                int particle = scheduler.scheduleSyncRepeatingTask(plugin, () -> {
    
    
                    int i;
                    int i2;
                    for (i = yWert2; i < (yWert2 + 11); i++) {
                        for (i2 = 0; i2 < 15; i2++) {
                            Location corner1 = chunk.getBlock(i2, i, 0).getLocation();
                            Location corner2 = chunk.getBlock(15, i, i2).getLocation();
                            Location corner3 = chunk.getBlock(15 - i2, i, 15).getLocation();
                            Location corner4 = chunk.getBlock(0, i, 15 - i2).getLocation();
                            /*
                            p.getWorld().playEffect(corner1, Effect.FIREWORKS_SPARK, 1);
                            p.getWorld().playEffect(corner2, Effect.FIREWORKS_SPARK, 1);
                            p.getWorld().playEffect(corner3, Effect.FIREWORKS_SPARK, 1);
                            p.getWorld().playEffect(corner4, Effect.FIREWORKS_SPARK, 1);
                            */
                            ParticleEffect.FIREWORKS_SPARK.display(0f, 0f, 0f, 0f, 2, corner1, 1.0);
                            ParticleEffect.FIREWORKS_SPARK.display(0f, 0f, 0f, 0f, 2, corner2, 1.0);
                            ParticleEffect.FIREWORKS_SPARK.display(0f, 0f, 0f, 0f, 2, corner3, 1.0);
                            ParticleEffect.FIREWORKS_SPARK.display(0f, 0f, 0f, 0f, 2, corner4, 1.0);
                            ParticleEffect.FIREWORKS_SPARK.display(0f, 0f, 0f, 0f, 2, p.getLocation(), 1.0);
    
                        }
                    }
                }, 0, 5L);
                p.sendMessage(ChatColor.GOLD
                        + "Glasblöcke zeigen für 7 Sekunden die Grenzen deines Chunks.");
                scheduler.scheduleSyncDelayedTask(plugin, () -> Bukkit.getScheduler().cancelTask(particle), totaltime);
     
    Last edited: Mar 14, 2015
  9. Offline

    EuGabyEu

    Is there a way to color the FIREWORK_SPARK ?
    I need them in different colors :\

    This
    ParticleEffect.FIREWORKS_SPARK.display(new ParticleEffect.OrdinaryColor(255, 0, 0), loc, 10);

    Doesn't work.
     
  10. Offline

    RingOfStorms

    no
     
  11. Offline

    VortexGmer

    @DarkBladee12
    Can you make it so that you can control how many seconds the particle stays for or something?
     
  12. Offline

    DarkBladee12

    @VortexGmer
    It's currently not possible to change how long a particle stays until it fades. However you can use a Runnable to display it continuously for a certain amount of time.
     
  13. Offline

    VortexGmer

    And can you move the particles around with a player?
     
  14. Offline

    RingOfStorms

    You can send particles with a velocity to give more of an affect of following, otherwise just spawn still particles every tick which gives an appearance of following the player.
     
  15. Offline

    VortexGmer

    ok
     
  16. Offline

    markus18

    I found the fix i put pull request with it
    Solved (open)
    I can't use colors in the redstone particles.

    i have a for that uses these colors
    Code:
    for (OrdinaryColor c : new OrdinaryColor[]{ new OrdinaryColor(128,0,128), new OrdinaryColor(0,0,255), new OrdinaryColor(0,255,255), new OrdinaryColor(255,255,0), new OrdinaryColor(255,0,0), new OrdinaryColor(230,95,0),  new OrdinaryColor(255,0,0)}) {
    
    inside the for i use methods to change the location to create an arch, then i use

    Code:
    ParticleEffect.REDSTONE.display(c, location, ParticleUtils.getPlayers());
    But it only paints a some of colors that i put in the array the rest it paints with white pink and strange colors that not are that I invoke
     
    Last edited: May 1, 2015
  17. Offline

    OnlyNoobDied

    any command can remove the particle effect?
     
  18. Offline

    2008Choco

    @DarkBladee12 :p This is so old, yet still so useful. But I have a question.
    I'm trying to get the particles of a redstone block breaking. I have everything all set up, but the only thing that's stumping me, is the ParticleData. I don't know what to set for that value :p

    If you could explain what particle data REDSTONE_BLOCK would be, and what I would put in that parameter, that would be fantastic <3
     
  19. Offline

    DarkBladee12

    @2008Choco
    You have to create an instance of BlockData if you want to display effects like BLOCK_CRACK or BLOCK_DUST. For displaying redstone block particles you'd have to put new BlockData(Material.REDSTONE_BLOCK, (byte) 0) for ParticleData parameter.
     
    2008Choco likes this.
  20. Offline

    2008Choco

    Okay so I did that, but it's giving me an error under "BlockData" :p
     
  21. Offline

    DarkBladee12

    @2008Choco
    Could you tell me which error showed up?
     
  22. Offline

    2008Choco

    @DarkBladee12 Don't bother :) I messed around with it a bit more and I managed to fix it
     
  23. Offline

    gpotter2

    Hey !

    Realy nice API !!!
    Using it in some of my plugins....

    I created another API using ReflectionUtils..... My api is with Title/Subtitle for 1.8...

    So i thanks you for this realy useful class :)
     
    Last edited: May 14, 2015
  24. Offline

    guitargun

    @DarkBladee12 do you known what sort of particle I can use the best for the shapes a cone preferably can be modified to have different colors. The current spel mob is a bit messy
     
  25. Offline

    LCastr0

    To use different colors, I'd prefer the redstone one
     
  26. Offline

    Jalau

    @DarkBladee12 Could you please add a fix for this: http://www.reddit.com/r/MinecraftCommands/comments/2hmy0v/blockcrack_particle/

    Because currently doing this: ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(Material.STAINED_GLASS_PANE, (byte) 4), .1f, .1f, .1f, 0, 10, p.getLocation().add(0, 1, 0), 20000); does just display gray stained glass particles probably because of that. I tested it with the command: /particle blockcrack_16544 ~ ~ ~ 1 1 1 1 10 and that does work with yellow particles of the stained glass.

    EDIT:
    Fixed it myself (starts at line 1448)
    Code:
                    } else {
                        ReflectionUtils.setValue(packet, true, "a", enumParticle.getEnumConstants()[effect.getId()]);
                        ReflectionUtils.setValue(packet, true, "j", longDistance);
                        if (data != null) {
                            if(effect == ParticleEffect.BLOCK_CRACK) {
                                int[] packetData = {1};
                                packetData[0] = data.getPacketData()[1]*4096+data.getPacketData()[0];
                                ReflectionUtils.setValue(packet, true, "k", packetData);
                            }
                            else
                                ReflectionUtils.setValue(packet, true, "k", data.getPacketData());
                        }
                    }
     
    Last edited: May 29, 2015
    DarkBladee12 likes this.
  27. Offline

    DarkBladee12

    Last edited: May 29, 2015
  28. Offline

    AztroCreationz

    @DarkBladee12

    I just keep getting the same error wherever is says "Class<?>". It says "The type Class is not generic; it cannot be parameterized with arguments <?>". I have searched for a solution on the internet, but nothing has helped!
     
    Last edited: Jun 19, 2015
  29. Offline

    DarkBladee12

  30. Offline

    AztroCreationz

    @DarkBladee12 Well, that would take a really long time since it happens on every line of code that contains "Class<?>".
    I'm happy that you wanted to help, but I got into packets and I have now learned how to do it using them! Thank you for all the effort, and for making the library even if it didn't work for me! :)
     
Thread Status:
Not open for further replies.

Share This Page