Solved Non-Deprecated way to set Wool itemstacks color via DyeColor?

Discussion in 'Spigot Plugin Development' started by Ugleh, Jul 12, 2019 at 3:19 AM.

  1. I'd like to create wool itemstack based off of a DyeColor. I used to do this as
    Code (Java):
    new Wool(DyeColor.BLACK).toItemStack(1);
    However material#Wool is deprecated, tells me to use BlockData in the JavaDocs however Wool does not have a subclass to BlockData like other materials now do. Is this one of those "deprecated but no new methods yet" kind of deals?
  2. md_5

    Administrator Developer

    All wool colours are separate items.
  3. I get that, but lets say I want to get the respected wool via the DyeColor, are you telling me I need to append _WOOL to the string value of DyeColor?
  4. Given a Sheep entity I wanted to get the wool instantly into my inventory without the wool dropping so I wanted to go Sheep#getColor, which gives me a DyeColor, and then set a wools color to that. However since there is now multiple different wool materials (which I already knew about) but no way to go DyeColor -> Specific Wool, I guess I had to just this janky method:
    Code (Text):
    Material woolMaterial = Material.getMaterial(sheep.getColor().name() + "_WOOL");