Yes, it’s me again.
Some items, like wool have special metadata, like 2, 6, 3 (colors). Is there a way (from ItemStack) to get that number?
/+ How to apply that int to ItemStack, for example from-to config.
Sponge does not support deprecated stuff within minecraft. That includes the meta data ids.
If you want to get and set that meta data, use the supported method.
BlockState block;
block.offer(Keys.WOOD_TYPE, WoodTypes.OAK); //sets
block.get(Keys.WOOD_TYPE); //gets
How to save that in config? And how to get it from config?
I tried to toString() this, but not working.
is that possible to do it with ItemStacks? Or how to get BlockState from ItemStack.
You can apply it to itemstacks, locations, TileEntity, etc. Take a look at the official docs.
As for saving, im assuming you want to save all info about the itemstack. There is a simple way to do this
ItemStack yourStack;
ItemStackSnapshot stack = yourStack.createSnapshot();
config.set(stack, TypeTokens.ITEMSTACK_SNAPSHOT); //saves the whole itemstack
config.getValue(TypeTokens.ITEMSTACK_SNAPSHOT); //gets the itemstack snapshot