Title is self-explanatory, but basically, I just want to get the NBT data of an ItemStack. I want the whole nbt, not just a tag. Raw, Pure NBT. I searched through some forum posts for this, but they're all old, and use NMS methods such as .getTag() which no longer exist in 1.18. Please help.
Sorry for the necro but for the people that get confused when they want to use NBT on the newer version here's how I do it. So from 1.14+ there is PersistentDataContainer. An example on how to use it Code: NamespacedKey key= new NamespacedKey(plugin, "yourKey"); ItemMeta meta = ... meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "CoolString"); String coolString = meta.getPersistentDataContainer().get(key, PersistentDataType.STRING); It's really easy and you no longer need to stress about version support if you use any version from 1.14 and up. Also here is a more in depth tutorial which explains things really nicely: https://www.spigotmc.org/threads/a-guide-to-1-14-persistentdataholder-api.371200/
I could be wrong, but I believe PersistentDataContainer to be an alternative to NBT, which would mean that it doesn't help in this case.
Hmm, well to be honest I'm not sure. If you add a tag with persistent data container to an item and then you go in minecraft and hover over the item (This is if you have CTRL + h activated) it will say NBT: 1 (Or however many tags you have).