How to create a FireWork explosion?

Discussion in 'Plugin Development' started by Rprrr, Jan 1, 2013.

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

    Rprrr

    Hi,

    I want to create a firework explosion.

    I know how I can create a firework entity, but it always takes a few ticks before this firework rocket explodes. The point is, I want to have the explosion directly.

    I tried to use .setLivedTicks() for this, but that didn't have any effect. Setting the power to 0 didn't work either, because it still takes a few ticks before the rocket explodes.

    So how could I make this rocket explode directly?

    Thanks in advance!

    - Rprrr
     
  2. Offline

    codename_B

  3. Offline

    fireblast709

    The only method I know is using Craftbukkit, and setting variable 'b' to 0
    Code:java
    1. ((CraftFirework)fireworkEntity).getHandle().b = 0;
     
  4. Offline

    Rprrr

    fireblast709
    Thanks, works great.

    codename_B
    I took a look at your fireworkeffectplayer, but I was a bit confused.. I couldn't really figure out how to use it. :l (I guess I'm too much of a noob for that. :s). Was I supposed to create a class with that code in my own plugin? Or..
     
  5. Offline

    codename_B

    You create a class with that content in your own plugin, then create an instance of it where you want to use it and call the method.
    It even had an example usage in the source code :/

    Code:
    FireworkEffectPlayer fplayer = new FireworkEffectPlayer();
    fplayer.playFirework(event.getPlayer().getWorld(), event.getPlayer.getLocation(), Util.getRandomFireworkEffect());
    
     
  6. Offline

    Rprrr

    codename_B
    Oops. I saw the example, but I didn't realise it had to be the same class name. :l (I renamed the class to FWE, then tried to use 'FireWorkEffectPlayer'). Quite dumb. :l

    Anyway, thanks for your help, I'll use your fireworkeffectplayer! Thanks. :)
     
Thread Status:
Not open for further replies.

Share This Page