Fire arrow from one location to another [Solved]

Discussion in 'Plugin Development' started by Ne0nx3r0, Apr 6, 2011.

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

    Ne0nx3r0

    How would I go about firing an arrow from one location to another? (starting from a block)

    ...

    That's all I've got, heh.
     
  2. Code:
    Location loc1 = player.getEyeLocation();
    Location loc2 = block.getLocation();
    loc2.setY(loc2.getBlockY()+2);
    loc2.setX(loc2.getBlockX()+0.5);
    loc2.setZ(loc2.getBlockZ()+0.5);
    
    block.getWorld().spawnArrow(loc2, new Vector(loc1.getX()-loc2.getX(), loc1.getY()-loc2.getY(), loc1.getZ()-loc2.getZ()), arrowSpeed, 12);
    This code spawns an arrow two block over the block and fires it in the direction of the player. The range is not the best, but it works ^^
     
    ne0nx3r0 likes this.
  3. Offline

    Ne0nx3r0

    Cool, that works great, thanks!
     
Thread Status:
Not open for further replies.

Share This Page