how do i get the block a arrow hit?

Discussion in 'Plugin Development' started by TheBreadCat, Aug 14, 2011.

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

    TheBreadCat

    is there a event that gets triggerd when a arrow hits a block?

    *bump*

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 18, 2016
  2. Offline

    feildmaster

    *thinks* projectile hit event. but that's for entity. so... I don't think so.
     
  3. Offline

    DrBowe

    It fires whenever it 'dies', which is whenever the arrow reaches its destination. This is one of the more recent changes (introduced in b1000)

    So, you *could* get the block that it lands in by getting the arrow's location, then retrieving the block from there.

    If you wanted to grab the block it 'sticks to', that would be a bit more tricky, as you'd have to use getBlockFace() and a couple of tricky algorithms to decide which face its on.
     
  4. Offline

    feildmaster

    @DrBoweNur : ahh... See I don't keep up with the changes too much. ;)
     
  5. Offline

    escape

    Keep in mind that in 1056 all projectile events have been removed in favor of entity events for arrows.
     
  6. Offline

    feildmaster

    @escape : yes that! I was looking for that.

    And I believe it was... "EntityDamagedByProjectile" that retired. ProjectileHit still exists.
     
  7. Offline

    escape

    yep instead of entityDamageByProjectile its EntityDamageByEntity.
     
Thread Status:
Not open for further replies.

Share This Page