Library [1.8] ParticleEffect v1.7

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

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

    mcdorli

    He posted the 2 class you need, copy and paste them, or just manage particles yourself (it's 3 line to create one)
     
  2. Offline

    shizleshizle

    Hi, I have a question. I want to use this with a menu and items people can click on. When they click the particle appears, and as they move it also appears. Now my problem is, I want people to be able to remove their particles, but how do I do this?

    Thanks in advance.
     
  3. Offline

    jetp250

    Hai. I'd love to use the library, but I can't fix a.. glitch? - myself. I have the newest classes, I'm sure. However, in ParticleEffect class, line 616, the 'PacketType' cannot be resolved :L Aye, it's probably something simple.. but .. smh. Any help?
    Code:
    Class<?> packetClass = PackageType.MINECRAFT_SERVER.getClass(version < 7 ? "Packet63WorldParticles" : PacketType.PacketPlayOutWorldParticles.getName());
    EDIT: Okay, uh, nvm o_o I re-copied the class, works perfectly now .-. Sorry for this xD
     
    Last edited: May 9, 2016
  4. Offline

    Mr. Sandwich

    I think this doesnt work in 1.10
     
  5. Offline

    minezbot

    Just did some edits to this to get it working with 1.10 and with the new particles.
    The version errors were being caused by the version only looking for 1 character as the version number (e.g. 7, 8, 9) but now that the game is on version 10 it only got 1 for the version number so was looking for the wrong packet class. I did some edits to this so now it just takes the number between the two underscores.
    I've also added the 5 new particles (Dragon breath, Endrod, Damage Indicator, Sweep Attack and Falling dust)

    Code:
    DRAGONBREATH("dragonbreath", 42, 9),
    ENDROD("endrod", 43, 9),
    DAMAGEINDICATOR("damageindicator", 44, 9),
    SWEEPATTACK("sweepattack", 45, 9),
    FALLINGDUST("fallingdust", 46, 10, ParticleProperty.REQUIRES_DATA);
    These may need a bit of editing for the particle properties but as they are they do work.

    Code:
    private static boolean isDataCorrect(ParticleEffect effect, ParticleData data) {
            return ((effect == BLOCK_CRACK || effect == BLOCK_DUST || effect == FALLINGDUST) && data instanceof BlockData) || (effect == ITEM_CRACK && data instanceof ItemData);
        }
    I've also edited this so it checks that falling dust has the right particle data.

    Code:
    public static void initialize() throws VersionIncompatibleException {
                if (initialized) {
                    return;
                }
                try {
                    String ver = PackageType.getServerVersion();
                    int un1 = ver.indexOf("_") + 1;
                    int un2 = ver.lastIndexOf("_");
                    version = Integer.parseInt(ver.substring(un1, un2));
                    if (version > 7) {
                        enumParticle = PackageType.MINECRAFT_SERVER.getClass("EnumParticle");
                    }
                    Class<?> packetClass = PackageType.MINECRAFT_SERVER.getClass(version < 7 ? "Packet63WorldParticles" : "PacketPlayOutWorldParticles");
                    packetConstructor = ReflectionUtils.getConstructor(packetClass);
                    getHandle = ReflectionUtils.getMethod("CraftPlayer", PackageType.CRAFTBUKKIT_ENTITY, "getHandle");
                    playerConnection = ReflectionUtils.getField("EntityPlayer", PackageType.MINECRAFT_SERVER, false, "playerConnection");
                    sendPacket = ReflectionUtils.getMethod(playerConnection.getType(), "sendPacket", PackageType.MINECRAFT_SERVER.getClass("Packet"));
                } catch (Exception exception) {
                    throw new VersionIncompatibleException("Your current bukkit version seems to be incompatible with this library", exception);
                }
                initialized = true;
            }
    And here is the final edit that fixed the version issue. This should still be backwards compatible.

    @DarkBladee12 could you be so kind to update the code with this so people can continue to use this with the new updates :)
     
  6. Offline

    Bammerbom

    @minezbot
    Wool colors, etc, don't work anymore
     
  7. Offline

    Gosuo

    I get errors with the .getMethod and .getField methods. They do not fit. How would I change them to be correct.
     
  8. Offline

    Eyeless-jack22

    What would I use if I wanted flame particles, going straight and like powers. Like shooting fire away from the player, and when it hit's an entity, they catch of fire.
     
  9. Offline

    Esophose

    @minezbot
    These fixes work great with no issues as of yet. Thank you.
     
  10. Offline

    mrsagency

    @minezbot
    You have saved my day, thanks for updating the fixes
    Btw I use this library on SurvivalPlus.
     
  11. Offline

    Tecno_Wizard

  12. Offline

    bwfcwalshy Retired Staff

  13. Offline

    james8470

    Tried these versions (thanks guys :p)
    But :

    ParticleEffect.DRIP_WATER.display(loc, 0, 0, 0, 0, 1);

    does not work the error is "create method: display"?
    Also tried (the getOnlinePlayers being for who it should be visible for):

    ParticleEffect.FLAME.display(loc, 0, 0, 0, 0, 1, 1, Bukkit.getOnlinePlayers());
     
  14. Offline

    Tecno_Wizard

  15. Offline

    james8470

    Nothing appears in console, I gave all the info I had already.
    :(
     
  16. Offline

    Zombie_Striker

    Then where was the error displayed?
     
  17. Offline

    james8470

    EDIT: Actually, problem is still there. Was looking at something else. Here's my code:
    Code:
    @EventHandler
    public void toggle(PlayerTeleportEvent event){
        final Player player = event.getPlayer();
            new BukkitRunnable(){
              
                Location loc = player.getLocation();
                double t = 0;
                double r = 2;
                public void run(){
                        t = t + Math.PI/16;
                        double x = r*Math.cos(t);
                        double y = r*Math.sin(t);
                        double z = r*Math.sin(t);
                        loc.add(x, y, z);
                        ParticleEffect.DRIP_WATER.display(loc, 0, 0, 0, 0, 1);
                        loc.subtract(x, y, z);
                if (t > Math.PI*8){
                        this.cancel();
                }
                }
            }.runTaskTimer(TPeffect.getPlugin(TPeffect.class), 1, 1);
            player.sendMessage(getConfig().getString("TeleportedMessage"));
    The error "Add cast to method receiver" (in Eclipse) appears on the line with the actually display of the particle effect. It might also have to do with the math as I had to get some help making it.

    I've got it now:


    Code:
    java.lang.Error: Unresolved compilation problem:
        The method display(Location, int, int, int, int, int) is undefined for the type ParticleEffect
    
        at me.james8470.TPeffect$1.run(TPeffect.java:75) ~[?:?]
        at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at net.minecraft.server.v1_10_R1.MinecraftServer.D(MinecraftServer.java:723) [spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at net.minecraft.server.v1_10_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at net.minecraft.server.v1_10_R1.MinecraftServer.C(MinecraftServer.java:668) [spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:567) [spigot-1.10.2.jar:git-Spigot-90f61bc-6053c5c]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
    [14:23:50 WARN]: [TeleportationEffect] Task #3 for TeleportationEffect v1.4 generated an exception
    
    Thanks guys :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 6, 2016
  18. Offline

    Tecno_Wizard

    Last edited: Oct 30, 2016
    james8470 likes this.
  19. Offline

    james8470

  20. Offline

    rafa_wr

    HELP!

    Here is my code:
    Code:
    ParticleEffect.REDSTONE.display(new OrdinaryColor(1, 1, 1), loc, 1);
    Eclipse doesn't identify what is OrdinaryColor and I don't know if it's an Library or anything else.
    I am trying to create simple colored particles.
     
  21. Offline

    Zombie_Striker

    @rafa_wr
    "OrdinaryColor" is a class from this library. You either forgot to import the class, or you forgot to add this library to your build-path.
     
  22. Offline

    rafa_wr

    Tanks! Eclipse wasn't finding the import so I just needed to do it manualy.
     
  23. Offline

    Esophose

    Here are the lines to add the new 1.11 particles
    Code:
    TOTEM("totem", 47, 11, ParticleProperty.DIRECTIONAL)
    SPIT("spit", 48, 11, ParticleProperty.DIRECTIONAL)
     
  24. Offline

    ryandv

    How do I let the particles let float 1 block above the player ?
     
  25. Offline

    ryandv

    Can you please update this to 1.11 ?
     
  26. Offline

    gdavid

    Repository not working! Fix pls!
     
  27. Offline

    AlvinB

  28. Offline

    PhantomUnicorns

  29. Offline

    AlvinB

    @PhantomUnicorns
    Well, this isn't just a spigot thing. Both Craftbukkit, Spigot and Bukkit contain these new methods.

    If you're using the latest version, there is no reason to be using libraries anymore.
     
  30. Offline

    CsontiX

    Hey! Please can you tell me whats wrong in it?
    Code:
    ParticleEffect.SPELL_MOB.display(255F, 255, 255F, 1, 0, ar.getLocation(), 3D);
    If I write this the particle will be black and it will be at one point
    If I write the next:
    Code:
    ParticleEffect.SPELL_MOB.display(255F, 5, 255F, 1, 0, ar.getLocation(), 3D);
    It will be Yellow but the particles aren't in one point :(
    @DarkBladee12
     
Thread Status:
Not open for further replies.

Share This Page