Resource [1.8] Customized colored particles. <-- RGB!

Discussion in 'Plugin Help/Development/Requests' started by ChipDev, Jan 2, 2015.

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

    ChipDev

    Using @DarkBladee12 's ParticleEffect Lib. and @RingOfStorms post, We now know using particle amount '0' gives us possibilitys to change the color of the particles MobSpellAmbient, MobSpell, And red_dust!
    How to:
    Change your ParticleEffect.java to
    THIS (open)

    http://pastebin.com/qTRxgh7e
    (Couldn't put code in, 34464 characters :p)

    That removes the check for the amount of 0 particles, All credit goes to darkbladee12!
    Next:
    Use this little class to get the colored particles, add it to your plugin! (You MUST Have ParticleEffect inside of your project somewhere!):
    Code:
    package utils;
    
    import java.util.List;
    
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    
    public enum ColoredParticle {
      
        MOB_SPELL("MOB_SPELL"), MOB_SPELL_AMBIENT("MOB_SPELL_AMBIENT"), RED_DUST("RED_DUST");
      
        private ColoredParticle(String name) {
            this.name = name;
        }
        String name;
        public void send(Location location, List<Player> players, int r, int g, int b) {
            ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, players);
        }
        public void send(Location location, int Distance, int r, int g, int b) {
            ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, Distance);
        }
    
    }
    
    Now you can easily do ColoredParticle.RED_DUST.send(location, 16, 23, 23, 23) to give you a color with 23, 23, 23!
     
    Last edited: Jan 3, 2015
  2. Offline

    sethrem

    Nice release, might use it.
     
    GrandmaJam and ChipDev like this.
  3. Offline

    ChipDev

    Oh yes, wrote this at night :p
    Changed code. ParticleEffect.valueOf(name) returns something like mobSpell, not MOB_SPELL! Edited!
     
  4. Offline

    API_Tutorials

    @ChipDev
    Finally, an utility from you that might be (slightly) useful.
     
    TigerHix and ChipDev like this.
  5. Offline

    RingOfStorms

    And he didn't even come up with it! At least he gave credit where it was due, so can't complain too much there :p
     
  6. Offline

    RawCode

    that library open sourced and posted on github...
    you can just provide link to github...
     
  7. Offline

    MisterErwin

    @ChipDev You might want to tell us why we need a modified ParticleEffect class, so we could modify the lib by ourself.

    And this is more a library with example than a tutorial.
     
    ChipDev likes this.
  8. Offline

    DarkBladee12

    @MisterErwin You'd have to remove this part of the code in the ParticleEffect class, because it disallows an amount of 0. This specific value enables certain features like setting color or direction with offsets!
     
    ChipDev likes this.
  9. Offline

    MisterErwin

    @DarkBladee12 psss :p
    Yeah - I already saw that while reading the comments on your thread
     
  10. Offline

    DarkBladee12

    @MisterErwin

    I'll keep that check in the class, but I'm going to add methods for all the mechanics once @RingOfStorms found them out ;)
     
  11. Offline

    ChipDev

    Yeah, but I decided to make a thread for it so oriole searching it could find it!
    @API_Tutorials
    Omg yus :3
     
  12. Offline

    Skionz

    Or... You could just use packets :)
     
  13. Offline

    ChipDev

    Yeah, packets :3 But this is for people that are currently using @DarkBladee12 's lib!
    Also, sense I tagged him, Ill make a version that you could just update the library to. (No other classes needed)
     
  14. Offline

    NathanWolf

    OMG OMG OMG.

    Sorry, but wow- thanks so much for this!
     
    ChipDev likes this.
  15. Offline

    ChipDev

    No problemo!
    (With the spells plugin, this would be really useful :D)
     
  16. Offline

    NathanWolf

    Yeah you can see why I'd want this :D

    As of now, I'm already using it! I added support for colorizing particles to EffectLib, and Magic now supports custom-colored effects, and effects that match your wand's core color. Hooray!
     
    ChipDev likes this.
  17. Offline

    ChipDev

    @DarkBladee12 I saw you implemented a version of this! Sweet!
     
  18. Offline

    timmaker

    @ChipDev does this also work with firework sparks?
     
  19. Offline

    Skionz

    No.
     
  20. Offline

    ChipDev

    Sadly, not yet.
    Mojang y u do dis
     
  21. Offline

    mine-care

    ChipDev likes this.
  22. Offline

    MiniDigger

  23. Offline

    Skionz

    @MiniDigger I see no mention of a 'PacketType' enum.
     
  24. Offline

    ChipDev

  25. Offline

    DarkBladee12

    @MiniDigger @Skionz @ChipDev I removed it since it was only used once in the lib. Now you have to get the packet by name with PackageType.MINECRAFT_SERVER.getClass(<name>)! (The name for 1.8 is PacketPlayOutWorldParticles and for 1.6 or lower is Packet63WorldParticles)
     
    ChipDev likes this.
  26. Offline

    MiniDigger

  27. Offline

    Techy4198

    So, as this does not work with firework sparks, how does the server make the colored particles for actual fireworks? There must be more hidden features in packets...
     
  28. Offline

    DarkBladee12

    @Techy4198 I don't think that there's more to this packet than @RingOfStorms already found out. Maybe the firework effects are kinda hard-coded.
     
  29. Offline

    RingOfStorms

    The server doesn't send firework explosions themselves per particle, it instead sends an entity animation on the firework entity that results in the client rendering the effect.

    There is currently no way to color the firework spark particle.
     
  30. Moved to Bukkit Alternates
     
Thread Status:
Not open for further replies.

Share This Page