Getting block player is standing on.

Discussion in 'Plugin Development' started by GeorgeeeHD, Aug 9, 2016.

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

    GeorgeeeHD

    In most cases, player.getLocation().getBlock().getRelative(BlockFace.DOWN) will return the block they are standing on. Look at this picture. I am standing on the edge of a dirt pillar. The dirt block is at -13, 104, 13 but as you can see by my coordinates, I am at -12, 104, 13. Is there a way to get the dirt block, not the air I am technically over. I can't just use getRelative, as I don't know the direction. The player could be on any side of the block.
     
  2. Online

    timtower Administrator Administrator Moderator

    @GeorgeeeHD If getrelative(down) returns air check surrounding blocks? See which one is the closest to the player.
     
  3. Offline

    GeorgeeeHD

    ooo using distance, makes sense. ty
     
Thread Status:
Not open for further replies.

Share This Page