Spawn Fireworks particles to direction.

Discussion in 'Plugin Development' started by _SavaLLL_, Apr 21, 2014.

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

    _SavaLLL_

    I want have line of fireworks particles to player EyeDirection. (Not explode only line!)
    I use this code:
    Code:java
    1. final Location loc = p.getEyeLocation();
    2. final Vector locp = p.getLocation().getDirection();
    3. Firework fire = (Firework) loc.getWorld().spawn(loc, Firework.class);
    4. fire.setVelocity(locp.multiply(4));

    But, this working wrong.
    What do it?
     
  2. Offline

    IkBenHarm

    _SavaLLL_
    try using this:

    Code:java
    1. Location location = p.getEyeLocation();
    2. BlockIterator blocksToAdd = new BlockIterator(location, 0D, *How Far?* );
    3. Location blockToAdd;
    4.  
    5. while (blocksToAdd.hasNext()) {
    6.  
    7. blockToAdd = blocksToAdd.next().getLocation();
    8.  
    9. // play effect here
    10. }
     
  3. Offline

    _SavaLLL_

    IkBenHarm I don't want play effect. I want make little particles fireworks on fly.

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    Derpiee

    You can use a library to spawn particles at a certain location.
     
  5. Offline

    _SavaLLL_

    I use this:
    Code:java
    1. BlockIterator blocksToAdd = new BlockIterator(loc, 0D, 100);
    2. Location blockToAdd = null;
    3. while(blocksToAdd.hasNext()) {
    4. blockToAdd = blocksToAdd.next().getLocation();
    5. ParticleEffect.FIREWORKS_SPARK.display(blockToAdd, 0, 0, 0, 0, 1);
    6. }

    But the distance is too small (15 blocks) how make more?
    I want use LineLocationEffect but lib too much. May have cropped version?
     
Thread Status:
Not open for further replies.

Share This Page