How do I place doors at given coords?

Discussion in 'Plugin Development' started by xxMatthewo, Feb 1, 2012.

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

    xxMatthewo

    Using world.getBlockAt(x,y,z).getTypeId(material.WOODEN_DOOR.getId()) does not work, just gives me a half door.
     
  2. Offline

    hammale

    thats cause doors are 2 blocks. u need to set both the top and the bottom AND set the data values. i cant remember the data value part but heres the basics:
    Code:java
    1.  
    2. Block bottom = world.getBlockAt(x,y,z);
    3. Block top = bottom.getRelative(BlockFace.UP, 1);
    4.  

    then, dont quote me on this, but i think the data value looks something like this:
    Code:java
    1.  
    2. Byte data1 = (0x8); //not sure on this syntax...
    3. Byte data2 = (0x4); //not sure on this syntax...
    4. top.setTypeIdAndData(64, data1);
    5. bottom.setTypeIdAndData(64, data2);
    6.  

    u can find more about the data values here :D
     
    dylanisawesome1 and xxMatthewo like this.
  3. Offline

    xxMatthewo

    Thank You!
     
    hammale likes this.
Thread Status:
Not open for further replies.

Share This Page