Launch Horizontal firework!

Discussion in 'Plugin Development' started by Mortal_Wombat, Aug 7, 2014.

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

    Mortal_Wombat

    I was fiddling with bukkit (i was bored). And started launching firework and got bored of having to stare up and was like hmm how can i do this!

    So if you wouldnt mind telling me how to Launch Horizontal fireworks! I will love you forver ;D.


    Thanks in advance!

    ~Mortal
     
  2. Offline

    Forseth11

    I have never tried doing this before but I am 90% sure you would do it like launching an arrow from a player... with velocities. Simple get the player's direction vector then set the fireworks velocity to the players direction vector and multiply() by what ever you want.
     
  3. Offline

    AoH_Ruthless

    Forseth11 Mortal_Wombat
    Fireworks naturally go upwards as a client-side. So, what you have to do to create a realistic looking horizontal firework is:
    • Get the location you want the firework to detonate (I am going to refer to it as l)
    • Get the vector linking the start location to the detonate location (l).
    • Use a BlockIterator (how I use it, there are other ways) and iterate through every block of the vector and spawn a firework packet (using NMS). When the block iterator has no next, spawn a firework effect (this should be at the location l).
    However, with the above the firework will be a white color (client limitations). So, you could instead spawn wool block particles instead to generate various colors.
     
    NathanWolf likes this.
  4. Offline

    Forseth11

    AoH_Ruthless so that's how it's done. I thought it was more simple. Lol mine would of probably shot like I diagonal bullet to the sky.
     
  5. Offline

    AoH_Ruthless

    Forseth11
    It would more or less go straight (provided you gave a horizontal vector) until it reaches an entity or a block, at which point it shoots straight up for a little bit then promptly explodes.
     
  6. Offline

    Mortal_Wombat

Thread Status:
Not open for further replies.

Share This Page