Getting colour values.

Discussion in 'Plugin Development' started by TheGamesHawk2001, Nov 25, 2014.

Thread Status:
Not open for further replies.
  1. hello, I was just wondering how I would get color values frog STAINED_CLAY.

    Like this:

    <REMOVED>

    EDIT: I also tried this :
    Code:java
    1. ItemStack RedClay = new ItemStack(Material.STAINED_CLAY, 1, (short) 14);
    2.  
    3.  
    4. @EventHandler
    5. public void onBlockBreak(BlockBreakEvent e){
    6. Player p = e.getPlayer();
    7. if (e.getBlock().getType().equals(RedClay)) {
    8. e.getBlock().getDrops().clear();
    9. p.getInventory().addItem(new ItemStack(Material.REDSTONE_BLOCK));
    10. e.getBlock().setType(Material.AIR);
    11. }
    12. }
    13. }


    And it didn't work..
     
  2. Offline

    FabeGabeMC

    TheGamesHawk2001
    Use e.getBlock().getData().getData() to get the data of the block.
    EDIT: It's deprecated so add: @SuppressWarnings("deprecation")
     
  3. Offline

    FabeGabeMC

    TheGamesHawk2001
    You are trying to get the type of an ItemStack (Material), asking it if it's an ItemStack.
     
  4. Offline

    CullanP

    Code:java
    1. ItemStack RedClay = new ItemStack(Material.STAINED_CLAY, 1);
    2. RedClay.setDurability((short)14);
     
Thread Status:
Not open for further replies.

Share This Page