Make a glass block colored/stained

Discussion in 'Plugin Development' started by Zarkopafilis, Jun 24, 2014.

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

    Zarkopafilis

    This doesnt work:
    Code:
    Location.getBlock().setType(Material.GLASS);
                    Location.getBlock().setData(DyeColor.getData(), false);
     
  2. Offline

    THEREDBARON24

    You can set data by using a byte, however, something like DyeColor is not implemented yet (I think)
     
  3. Offline

    IvyCode

    Code:java
    1. Location loc = ...;
    2. loc.getBlock().setType(Material.STAINED_GLASS);
    3. loc.getBlock().setData(DyeColor.RED.getData());

    Deprecated, but functional.
     
  4. Offline

    Zarkopafilis

    It works for the wool....For the glass is there a documentation page showing the bytes or not? I cant find one
     
  5. Offline

    desht

    Zarkopafilis you need to use Material.STAINED_GLASS. The data bytes should be the same as for wool, e.g. this should work:
    PHP:
    block.setTypeIdAndData(Material.STAINED_GLASS.getId(), DyeColor.BLUE.getWoolData(), true);
     
    Zarkopafilis likes this.
Thread Status:
Not open for further replies.

Share This Page