Fireball

Discussion in 'Plugin Development' started by mattibijnens, Feb 20, 2014.

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

    mattibijnens

    How can I make this fireball shoot in front of the player? Because when I now fire it, It explodes on my character.

    Code
    Code:java
    1. if(p.getInventory().contains(Ghast)){
    2. e.setCancelled(true);
    3. p.launchProjectile(Fireball.class).setVelocity(e.getProjectile().getVelocity().multiply(2));
    4. }
     
  2. Offline

    DogeDev

    Try this. :)
    Code:java
    1. e.setCancelled(true);
    2. Vector lookat = p.getLocation().getDirection().multiply(4);
    3. Projectile proj = p.launchProjectile(Fireball.class);
    4. proj.setShooter(p);
    5. proj.setVelocity(lookat);
     
  3. Offline

    mattibijnens

    DogeDev I tested a bit and it works more often now, but still fails quite a lot :/
     
  4. Offline

    DogeDev

    mattibijnens Fails? That code has never failed for me... How are you using it?
     
  5. Offline

    mattibijnens

    DogeDev It first hits me and then flys further, but I used the blaze fireball now which works fine :)

    DogeDev I used it when they shot with a bow btw :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page