Launch projectile from location

Discussion in 'Plugin Development' started by Smartloser, Jun 17, 2014.

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

    Smartloser

    Hey guys.

    I was wondering if there was a way to launch projectile from a location.

    Regards,
    Smartloser
     
  2. Code:Java
    1.  
    2. world.launchProjectile(location, Arrow.class);
    3.  
     
  3. Offline

    Smartloser

  4. Offline

    unrealdesign

    Location#getWorld().sendProjectile(Location#, Arrow.class);
     
  5. Offline

    Smartloser

    AdamQpzm unrealdesign
    I managed to spawn an arrow, but the velocity isn't working correctly:
    Code:java
    1.  
    2. final Arrow a = world.spawnArrow(startloc, endloc.toVector(), (float) 1, 20);
    3. a.setVelocity(endloc.toVector());
    4.  

    The arrow is shot to the opposite direction..
     
  6. Offline

    Gamecube762

    AdamQpzm likes this.
  7. Offline

    IDragonfire

    Is there any API method like LivingEntity#launchProjectile to launch other Proectiles, like Fireballs from any location?

    I found it:
    Code:java
    1. org.bukkit.entity.Fireball fb = (org.bukkit.entity.Fireball) top.getWorld()
    2. .spawnEntity(top, EntityType.FIREBALL);
    3. // velocity is bugged ... cannot change the speed
    4. // fb.setVelocity(new Vector(0, -0.8, 0));
    5. fb.setDirection(new Vector(0, -1, 0));
    6. fb.setIsIncendiary(false);


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

Share This Page