Closed kingOf0 closed 2 years ago
That code doesn't make sense. If itemStack
variable is actually an ItemStack
then it doesn't have a type
field, I need to know how you constructed that variable.
Sorry it was in kotlin. In kotlin you can use getType()
as a field like type
.
Heres a java example. (not written in an IDE)
ItemStack itemStack = new ItemStack(Material.PORK);
LOGGER.info(itemStack.getType().name);
LOGGER.info(XMaterial.matchXMaterial(itemStack).name);
Sorry it was in kotlin. In kotlin you can use
getType()
as a field liketype
. Heres a java example. (not written in an IDE)ItemStack itemStack = new ItemStack(Material.PORK); LOGGER.info(itemStack.getType().name); LOGGER.info(XMaterial.matchXMaterial(itemStack).name);
Should be .name()
Oh sorry, I didn't consider kotlin. Fixed in v8.6.2
matchXMaterial(ItemStack)
converts Raw Porkchop to Cooked Porkchop.Code To Generate
Tested on 1.8.8 with XSeries 8.6.1
Note: sorry for edit. I Miss clicked enter.