Arrows

Discussion in 'Plugin Development' started by Deckerz, Feb 19, 2013.

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

    Deckerz

    Hey, how would i keep a arrow from dipping and make it travel in a straight line and at high speed?
     
  2. Offline

    Hoolean

    Make it travel in a straight line forever or just for a bit? Forever would be inpracticle (arrow goes on forever, needs to generate chunks etc) but if you just power then do this...

    Code:
    @EventHandler
    public void onFire(ProjectileLaunchEvent event) {
     
        if(event.getEntity() instanceof Arrow) {
     
            if(event.getEntity().getShooter() instanceof Player) {
     
                event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(POWER GOES HERE - DEFAULT IS 1));
     
            } 
     
        }
     
    }
     
  3. Offline

    Deckerz

    i want it to travel in a straight line until another method removes it. BTW im making guns
     
  4. Offline

    Hoolean

    declanmc96

    If you are familiar with schedulers then set it's velocity every tick and then cancel that task when you want to remove it :)
     
  5. Offline

    Deckerz

    I know how to but i can get the velocity right, because it starts going upwards. Also with the repeater thing there it stops ProjectileHitEvent being called
     
  6. Offline

    Hoolean

    Keep setting it to the velocity that it had on spawn multiplied by a value :)
     
Thread Status:
Not open for further replies.

Share This Page