[Solved] About Colored Glass

Discussion in 'Spigot Plugin Development' started by AgentBeatzPH, Jul 11, 2015.

  1. Code (Text):
    world.getBlockAt(location.getBlockX(), location.getBlockY()location.getBlockZ()).setType(Material.STAINED_GLASS);
    How i can make it Dyed/Colored Stained Glass, like Lime Stained Glass??
     
  2. You could make a new block and place it at that location using material data to set the color of the stained glass.
     
  3. I need codes ._.
     
  4. Like @terturlcraft said create a block field for stained glass and set the data of the block to the colors do it by <field>.setdata(1);
     
  5. Getting the location of the block you need:
    Location loc = world.getBlockAt(//...);

    ItemStack item = new ItemStack(Material.STAINED_GLASS, 1, (short) 1);

    loc.setBlock(item);

    Should set the block at the current location to a colored stain glass (white I believe)
     
  6. Block block = (get block whereever)
    then set its data.
     
  7. Code (Text):
    block.setTypeIdAndData(id, data, false/true);
     
  8. So in your case it would be;
    Code (Text):
    world.getBlockAt(location.getBlockX(), location.getBlockY()location.getBlockZ()).setType(Material.STAINED_GLASS.getId(), lime-data, false);
     
    • Winner Winner x 1
  9. It's Work dude! thanks!
     
  10. Put the Thread title as "[SOLVED] About Colored Glass" please.
     
  11. Updated!