Solved LargeFireBall Issue

Discussion in 'Plugin Development' started by L33m4n123, Dec 7, 2013.

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

    L33m4n123

    Hey guys,

    What I am trying to achieve is a FireBall rain. Following is what I want to do

    • get Location from Config [works]
    • spawn LargeFireballs in a radius arround that Location 15 blocks higher [works]
    • Let them rain down straight down and explode onhit [not working]
    So yeah. What exactly it is that doesn't work for the last part. I spawn them in. Set their Direction and they just explode where they spawn. But they do not fall/travel into the direction I want it to. Might be that I need a different approach
    How I spawn the LargeFireballs in and set their direction is as follows
    Code:java
    1. if (ability.equalsIgnoreCase("fireball")) {
    2. final Vector fall = new Vector(0.0, -1.0, 0.0);
    3. final Location fireballLoc = loc; // gets the location from the Config. Works
    4. fireballLoc.setY(loc.getY() + 15.00);
    5. final Location fireballOneLoc = fireballLoc;
    6. final Location fireballTwoLoc = fireballLoc;
    7. int ammount = 0;
    8. while (ammount < 10) {
    9. System.out.println(ammount); // Debug message to see if it works
    10. if (ammount % 2 == 0) {
    11. fireballOneLoc.setX(fireballOneLoc.getX() - 1);
    12. fireballOneLoc.setZ(fireballOneLoc.getZ() - 1);
    13. LargeFireball eOne = Bukkit.getServer().getWorld("kd")
    14. .spawn(fireballOneLoc, LargeFireball.class);
    15. System.out.println("FireballOne" + " " + eOne.getLocation()); //double confirmation. Spawns where it needs to
    16. eOne.setDirection(fall);
    17. } else {
    18. fireballTwoLoc.setX(fireballTwoLoc.getX() + 1);
    19. fireballTwoLoc.setZ(fireballTwoLoc.getZ() + 1);
    20. LargeFireball eTwo = Bukkit.getServer().getWorld("kd")
    21. .spawn(fireballTwoLoc, LargeFireball.class);
    22. System.out.println("FireballTwo" + " " + eTwo.getLocation()); // tripple confirmation. Spawns where it should
    23. eTwo.setDirection(fall);
    24. }
    25. ammount++;
    26. }
    27. }
    28.  

    So what it does.
    It spawns the 10 Fireballs.
    All in different locations. (Confirmed by Comments)
    However they explode imideatly.
    so I kinda guess I might have to do it different because the Fireball explode right on spawning in. But I cannot think of a way of doing it correctly
     
  2. Offline

    Wolfey

    Why did you post two topics for this?
     
  3. Offline

    L33m4n123

    Did I? My browser screwed up then. sorry

    Edit:

    Ok.. duh. Should not be coding at 5 in the morning. some of them exploded simply midair because they colided on their path (because setDirection still gives them a random direction)

    however the main issue was that I had a runnable within the plugin that removed all entitys except certain ones.. forgot to add LargeFireball in there. sorry guys :cool:
     
Thread Status:
Not open for further replies.

Share This Page