Solved Set direction of anvil relative to direction player is facing

Discussion in 'Spigot Plugin Development' started by Vhbob, Jul 12, 2018.

  1. Hello, I am changing a targeted block to an anvil however its direction does not change relative to the players. How would I go about doing this? I know it has to do with the BlockFace but how do I change this?
     
  2. my best guess would be the blockmeta?
     
  3. blockmeta does not exist. Did you mean BlockStateMeta? And if so I dont believe that will solve anything.
     
  4. FrostedSnowman

    Resource Staff

    Block#setData

    you may want to update the state after you do so.

    Block#getState
     
  5. Thanks, now how do i get the direction (N S E W) that the player is facing?
     
  6. FrostedSnowman

    Resource Staff

    EntityPlayer has a getDirection method. use that and get the data that correlates to the direction.

    ((CraftPlayer) player).getHandle();