Solved Use a flight time <0.5s for Fireworks

Discussion in 'Plugin Development' started by GusGold, May 27, 2013.

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

    GusGold

    Hello there,

    So I am wanting to have fireworks activate with a flight time of less than 0.5s. Currently I am spawning them in as such:
    Code:
     Firework firework = locale.getWorld().spawn(locale, Firework.class);
    FireworkMeta startFirework = (FireworkMeta) firework.getFireworkMeta();
    FireworkMeta finishFirework = (FireworkMeta) firework.getFireworkMeta();
    startFirework.addEffects(FireworkEffect.builder().withColor(Color.RED).with(Type.BALL).build());
    startFirework.setPower(1);
    finishFirework.clearEffects();
     
    firework.setFireworkMeta(startFirework);
    firework.setFireworkMeta(finishFirework);
    and this cancels the fireworks before they explode, but they still fly up for 0.5s due to the setPower(1).
    Am I able to cancel them earlier, like after 0.1s, or better yet, remove their upwards velocity (set it to 0)?

    Thanks for the help.
     
  2. Offline

    DarkBladee12

    GusGold So you basically want to let the fireworks explode instant? If yes, take a look at this.
     
  3. Offline

    GusGold

    DarkBladee12 Kinda, but thanks to that link, I found the method remove() for entities which does what I want it to do. Cheers!
     
Thread Status:
Not open for further replies.

Share This Page