I am using Bukkit API 1.8.3
I am trying to compare ItemStacks
based on their Material
and MaterialData
, to do this I must make the ItemStacks
exactly the same and then change the Material and MaterialData
of one ItemStack
.
I know how to change the material using setType()
but I do not know how to set a MaterialData
. The method for this is setData(MaterialData)
However, how do you have MaterialData
as a variable?
I searched on Google, Stackoverflow, Spigot forums and bukkit forums and could not find an answer.
How can I set MaterialData
to an ItemStack
?
NOTE: I cannot try this with no hint or idea on how to do this
I haven't tested it, but you can use getType() on your Itemstack, to get the Material and call getData() afterwards to get the MaterialData.