Fireworks...

Discussion in 'Plugin Development' started by bkleinman1, Nov 9, 2013.

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

    bkleinman1

    Is there a way to make fireworks explode earlier that they usually would, does it have something to do with the power of it?

    Also, as i am shooting my fireworks horizontally rather than vertically, is there a way to make it so when the firework crashes into a block, it explodes there.

    this is what i have so far in the code:

    Code:java
    1. public void onPlayerInteract(PlayerInteractEvent event) {
    2. Player player = event.getPlayer();
    3. if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
    4. if (player.getItemInHand().getType() == Material.DIAMOND_HOE) {
    5. Firework fw = (Firework) player.getWorld().spawn(player.getLocation(), Firework.class);
    6. FireworkMeta fm = fw.getFireworkMeta();
    7. fm.addEffect(FireworkEffect.builder().flicker(false).trail(true).with(Type.BALL).withColor(Color.RED).withFade(Color.BLUE).build());
    8. fm.setPower(1);
    9. fw.setFireworkMeta(fm);
    10. Location locFwd = player.getLocation().clone();
    11. Vector vecFwd = locFwd.getDirection();
    12. fw.setVelocity(vecFwd);
    13. }
    14. }
    15. }


    Thanks :)
     
  2. Offline

    thepaperboy99

Thread Status:
Not open for further replies.

Share This Page