Spigot NBT API 2.8.0

Add custom NBT tags or modify tags of Items/Entities/Tiles without NMS!

  1. Yes, no and yes :D
  2. Can you please add an Item Example for getObject and setObject?
  3. Take a look at the Gson lib. Basically you give the method an Object, and the object will be turned into a string and saved into the item. When getting the Object back you give it the Class that object had, and it will reconstruct the Object using the class and String.
  4. Makes sense now :D
  5. tr7zw updated Item NBT API with a new update entry:

    TileEntity and Entity Update!

    Read the rest of this update entry...
  6. tr7zw updated (Item/Entity/Tile) NBT API with a new update entry:

    1.7 update

    Read the rest of this update entry...
  7. How can I add this to a Maven repository?
    I have the jar and added it to the Lib, but I need the GroupId and ArtifactId so I can it to the pom.xml like so:
    Code (Text):

    <!-- Item-NBT-API -->
    Any idea what I should put as the Group and Artifact ID's?
  8. https://github.com/tr7zw/Item-NBT-API/blob/master/pom.xml
    Code (Text):
    But is this jar even in a public repository? And also the pom is broken anyway.
    EDIT: nvm, you are referencing a local jar. By the way, when shading the jar (not sure if you can with this API) you probably want to relocate it to your plugin package as well so it doesn't conflict with other plugins using the API.
  9. Not able to add a compound why?

    NBTCompound comp = nbti.getCompound("CraftCube");
    if (comp == null) {
    comp = nbti.addCompound("CraftCube");
    if (comp.getString("StatTrak") == null || comp.getString("StatTrak").isEmpty()) {
    comp.setString("StatTrak", p.getUniqueId().toString());

    Not working
  10. What does it say/is there an error? Because this should work.
  11. tr7zw updated (Item/Entity/Tile) NBT API with a new update entry:

    NBT Files

    Read the rest of this update entry...
  12. Hi, I'm a developer and I have a couple of questions.
    First of all, your API is great and now I don't have headache because of NMS.
    I'm trying to add a command that changes attributemodifiers and unbreaking tag. It only changes the specified attribute, while leaving the others untouched. With NMS I never made it work and now I'm trying to do it again, but it still don't works.
    The command changes the item that the sender has in his hand, but when I try to change unbreaking tag, it does nothing. When I try to change one AttributeModifiers like generic.attackDamage, every modifier dissapears. How can I modify a tag leaving the others intact?
    And another question, I've read that UUIDMost and UUIDLeast are values of type long, but there isn't a setLong method. Do you plan to add it? I'm not really interested, I'm just curious about it.
  13. Make sure you use .getItem() after modifying the tags, and then setting the item again. The NBTItem is a copy of the original items stack. Also there is a setLong method?
  14. I'm using .getItem(). The item gets modified, but it always remove every tag on the item or at least makes them dissapear.
    I don't understand the setLong question.
    Thanks for your quick answer :3
  15. Huh send me your code in a pm, but there should be a .setLong and tags shouldn't get removed. I'll take a look at it :D
  16. Hey @tr7zw! Loving this API. Just wondering if there was a way to print the actual NBT line, instead of the formatted version that all of the .toString() methods spits out? Minor thing that I need it for and would be great to have a way of doing so!
  17. There is a method :D. asNBTString() gives you the actual NBT line used by the /give command etc. The other way around you can use new NBTContainer(json) to parse it back, and mergeCompound(comp) to merge the read in NBTContainer back into an ItemStack.
  18. Great work on the API!

    Anyway you can help link to vanilla NBT tags on items so that I may modify vanilla values? This kind of info would be great for your documentation. :)

    Thanks again!
  19. tr7zw updated (Item/Entity/Tile) NBT API with a new update entry:

    Internal rewrite, 1.13 update

    Read the rest of this update entry...
  20. Hey there,
    Congratulations on the rewrite and the extremely fast 1.13 release. I would like to use this API in my own plugin to replace an old comphenix NBT API that I use to add Custom NBT Data to ItemStacks. Is there any public maven repo available for the latest release? Alternatively, could I clone the item-nbt-api and include the local Maven?
    Thank you for the great resource!