CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
403 stars 126 forks source link

XMaterial | Incorrect conversion of Porkchop #163

Closed kingOf0 closed 2 years ago

kingOf0 commented 2 years ago

matchXMaterial(ItemStack) converts Raw Porkchop to Cooked Porkchop.

Code To Generate

LOGGER.info(itemStack.type.name)
LOGGER.info(XMaterial.matchXMaterial(itemStack).name)
[20:30:16 INFO]: PORK
[20:30:16 INFO]: COOKED_PORKCHOP

Tested on 1.8.8 with XSeries 8.6.1

Note: sorry for edit. I Miss clicked enter.

CryptoMorin commented 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.

kingOf0 commented 2 years ago

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);
LOOHP commented 2 years ago

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);

Should be .name()

CryptoMorin commented 2 years ago

Oh sorry, I didn't consider kotlin. Fixed in v8.6.2