Solved Get Block From ProjectileHitEvent

Discussion in 'Plugin Development' started by leimekiller, Aug 31, 2013.

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

    leimekiller

    How do I get the x, the y(+1) and the z locations from the block which has been hitted by an arrow?
     
  2. Offline

    curlyfries1999

    Code:java
    1. @EventHandler
    2. public void onProjectileHit(ProjectileHitEvent e) {
    3. e.getEntity().getLocation().getBlock()
    4. }
     
  3. Offline

    leimekiller

    curlyfries1999 I know that, but I need to get the block above that one.
     
  4. Offline

    chasechocolate

  5. Offline

    curlyfries1999

    Code:java
    1. @EventHandler
    2. public void onProjectileHit(ProjectileHitEvent e) {
    3. e.getEntity().getLocation().add(0, 1, 0).getBlock();
    4. }
     
  6. Offline

    leimekiller

    chasechocolate I can't find getRelative...

    curlyfries1999 So how do I replace that block with another one?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  7. Offline

    curlyfries1999

    leimekiller I'm not sure, but I think you can do .setTypeId(int);
     
  8. Offline

    chasechocolate

Thread Status:
Not open for further replies.

Share This Page