Redstone particles.

Discussion in 'Spigot Plugin Development' started by Marido, Jun 10, 2018.

  1. Hello everyone.
    It's a while ago that I posted an issue, but today I'm back with a brand new one.

    I'm having issues with spawning redstone particles in a small ball, and currently this code (copied from someone else) works:
    Code (Text):
    location.getWorld().spigot().playEffect(loc, Effect.COLOURED_DUST, 0, 1, red, green, blue, 1, 0, 64);
    RGB values - 1 1 0

    But it's just a really small particle, and I need to increase the amount, but when I change the amount the redstone particle goes away and I'd see the fucked up mixed colors.

    Any help? Thanks.
  2. I prefer to not use any external dependencies.
  3. then you have to run that into loops you can use while or for loops to produce extra particles
  4. Isn't there an other way to increase the amount of particles without making it a floppy rainbow again?
  5. try this

    location.getWorld().spigot().playEffect(loc, Effect.COLOURED_DUST, 0, 1, red, green, blue, 1, 10, 64);

    i just changed the particle count to 10 before the 64 radius
  6. Say hello to the rainbow particles. I already tried that, just tested it again and still the same issue.
  7. well either try the library in my link or loop it if you want you can put the whole library inside your jar and reference it in your package so server owners dont have to download the library for your plugin to work
  8. Yes, you can't spawn colored particles when amount > 0. Just know that if you do get the lib, it'll do exactly this under the hood. So, to spawn 10 colored redstone particles, spawn the particle 10 times rather than setting the amount to 10.
    Not sure why Mojang did it this way, but I sure hope it gets changed in the future, although doesn't seem likely :(

    Edit: I'm gladly proven wrong, I really hope Choco is right
    #9 jetp250, Jun 10, 2018
    Last edited: Jun 10, 2018
  9. Choco


    Fairly certain this was changed in 1.13, and we were also given a much cleaner API for it. Particle.DustOptions
    • Agree Agree x 2
    • Useful Useful x 1
  10. I still highly recommend using the library as to not deal with complex mathematics which I am very poor in. lol
    But if you can handle vertexes and warping angles then hey do not use the library and good for you.
  11. Choco


    If you want to spawn a ball of particles, it's really not terribly difficult. Assuming you want a spherical shape, it's really only just a bunch of circles with varying radii. Luckily for you, those radii vary in the form of a negative cosine function (-cos(theta)), or half of a sin function. Depending on whether you use a cos or a sin function, loop from 0 to Math.PI * 2 (circumference of a circle in radians. Iterate to Math.PI if you use a sin function) with an interval of, perhaps Math.PI / 6 (this results in 12 circles from top to bottom), and in that loop, create another loop from 0 to Math.PI * 2 to draw circles on a Cartesian plane multiplied by the radius provided by the inverted cosine function. It's not terribly complicated math.

    For a better, more visualized explanation on spheres, see @finnbon's resource on the topic which provides you with code examples. Amazing resource if you're not super knowledgeable on trigonometric functions or the Cartesian circle
  12. wooossshhh "mind blown" feels like my brain is on fire haha ill take a look at the link
    • Like Like x 1
  13. Choco


    It's just some Grade 11 - 12 applications of trigonometry :D Super easy to understand if you've made your way through at least basic algebra and sinusoidal functions.
  14. nope slept through that the whole year haha passed it by the minimum
    • Funny Funny x 2
    • Agree Agree x 1
  15. NathanWolf


    Well technically making a ball is even easier - a single particle packet can make a ball. You'll need 1.13 to do it with colored particles, but it's basically just a matter of setting a large count and making the x/y/z offsets the radius you want.