[UNSOLVED] How to get the entity a projectile hit on?

Discussion in 'Plugin Development' started by MinecraftShamrock, Nov 12, 2013.

Thread Status:
Not open for further replies.
  1. Hey guys.
    I listen to the ProjectileHitEvent and I need to get the entity hit by the projectile.
    Is that possible with event.getProjectile().getNearbyEntities(1, 1, 1); ?
    And if the returned array's length is 0 no entity was hit.
    Is that correct?
     
  2. Offline

    thepaperboy99

    You can use event.getEntity(), to get the entity hit. http://jd.bukkit.org/rb/apidocs/org/bukkit/event/entity/ProjectileHitEvent.html
     
  3. Offline

    Codex Arcanum

  4. Offline

    thepaperboy99


    Oh sorry, I thought it was the entity hit
     
  5. Offline

    SmellyPenguin

    Think you should try listening to EntityDamageEvent and then checking if the damage cause is a projectile or w/e.
     
  6. Offline

    drtshock

  7. Offline

    xTrollxDudex

    MinecraftShamrock
    Actually, I think it should have an entity using .getNearbyEntities(0, 0, 0) and check if it is instanceof LivingEntity if the rpojectile hit an entity
     
  8. Offline

    Goblom

    You can get the shooter from a projectile...

    event.getProjectile().getShoot() i believe

    DONT LISTEN TO ME
     
  9. Offline

    xTrollxDudex

    Not sure if trolling or...
     
  10. Offline

    Goblom

    xTrollxDudex :eek: I totally didn't event read the title of this post... All i saw was projectile and was like hey i can show him how to get shooter...
     
    xTrollxDudex likes this.
Thread Status:
Not open for further replies.

Share This Page