Solved Arrows always bounce.

Discussion in 'Spigot Plugin Development' started by Gsoares1928, Jul 16, 2015.

  1. I'm making a Barrage Perk and everything is working fine but I having a problem:
    The arrows, except the first, bounces back when hit a mob and dont deal any damage.
    I use this code to fire the arrow and fire one per tick.
    Code (Text):

    Arrow arrow = player.launchProjectile(Arrow.class);
    arrow.setVelocity(player.getLocation().getDirection().add(v).multiply(3));
    arrow.setBounce(false);
     
    I uploaded this video to show the problem:
     
  2. Inkzzz

    Resource Staff

    Set the bounce, before Velocity?
     
  3. Still bouncing
     
  4. Is this getting called when you shoot a bow?
     
  5. I think this happens because a mob can't be hit with that many arrows at once. They have a no-damage cooldown of 10 ticks. Unless you create a custom nms mob, I don't think there's anything you can do to change this, sorry :( Good luck!
     
    #5 Fedmand, Jul 16, 2015
    Last edited: Jul 16, 2015
    • Agree Agree x 1
    • Friendly Friendly x 1
  6. Yes, when i shoot the bow i scheduler a repeting task
     
  7. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#setNoDamageTicks(int)

    Should be able to set that to 0 ticks to allow multiple damage extremely fast. ;)

    Just dont forget to find out what the value is originally (first), then set it back to that after you are done dealing extreme damage to it.
     
  8. I added this but my arrows still bouncing:
    Code (Text):

    @EventHandler
        public void onDamage(EntityDamageByEntityEvent event) {
            if (event.getDamager() instanceof Arrow
                    && event.getEntity() instanceof LivingEntity) {
                ((LivingEntity)event.getEntity()).setNoDamageTicks(0);
            }
        }
     
  9. If its not the no damage ticks.. Its most likely hitting the dead corpse and just bouncing off. You might need to shoot a custom arrow and modify it to your needs.

    Damage ticks is time inbetween each hit it will do damage.

    But since you're shooting 10+ arrows, at about same time. 8 of those are gonna bounce off the dead body and two are gonna kill the cow.
     
    • Winner Winner x 1
  10. I created my custom arrow class and this is working fine now.
    Class if someone want: http://paste.md-5.net/dagehitipa.avrasm
     
  11. Link to your fix is dead, and I am currently experiencing this issue with another plugin. Any chance you can re-upload or fix the link to your fix please?
     
  12. Any update?

    That link's dead, and I also can't stop arrows bouncing.

    My plugin also shoots lots of arrows at once from a player but only the first one hits, the rest bounce and sometimes even damage the shooter themselves.