Solved MaterialData not working!!!

Discussion in 'Plugin Development' started by CruzAPI, Jul 10, 2016.

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

    CruzAPI

    I'm trying to rotate stairs, instead of use block.setData(byte data); I am using the Stairs class and stairs.setFacingDirection(); but it isn't working.

    Here is the code:
    Code:
    @EventHandler
    public void interactTEST(PlayerInteractEvent e)
    {
      Block b = e.getClickedBlock();
     
      MaterialData materialdata = b.getState().getData();
     
      if(materialdata instanceof Stairs)
      {
        Bukkit.broadcastMessage("test");
        Stairs stairs = (Stairs)blockdata;
        stairs.setFacingDirection(BlockFace.NORTH);
      }
    }
    I am interacting with the stair, it is broadcasting "test" but it is not rotating to North...
    Please help

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

    kampai

    Code:
           @EventHandler
           public void interactTEST(PlayerInteractEvent e)
           {
             Block b = e.getClickedBlock();
           
             MaterialData materialdata = b.getState().getData();
           
             if(materialdata instanceof Stairs)
             {
               Bukkit.broadcastMessage("test");
               Stairs stairs = (Stairs) materialdata;
               stairs.setFacingDirection(BlockFace.NORTH);
               b.setData(stairs.getData());
             }
           }
     
  3. Offline

    CruzAPI

    Thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page