Solved Colored stained clay

Discussion in 'Plugin Development' started by Deleted user, Sep 2, 2014.

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

    Deleted user

    How can I set the color of a block of stained clay?
    This is deprecated:
    Code:java
    1. Block.setData(DyeColor.WHITE.getDyeData());

    How can I set the color of a stack of stained clay?
    This is deprecated:
    Code:java
    1. ItemStack stack = new ItemStack(Material.STAINED_CLAY, 1, (short)0, DyeColor.WHITE.getDyeData());
     
  2. Offline

    desht

    Deprecated doesn't mean you can't use it, and in this case it's the only option, since there isn't any API at this point for setting the colour of stained clay (maybe in future a StainedClay subclass of MaterialData will be added).

    I will note though that stained clay uses the same data values as wool, so you should be using .getWoolData() rather than .getDyeData(). Also, you're better off using the (not deprecated) 3-arg ItemStack constructor:
    PHP:
    ItemStack stack = new ItemStack(Material.STAINED_CLAY1DyeColor.WHITE.getWoolData());
     
  3. Offline

    Deleted user

    desht Thank you very much.
     
Thread Status:
Not open for further replies.

Share This Page