Skip to content

ViaVersion/ViaNBT

Repository files navigation

ViaNBT

ViaNBT is a library for dealing with NBT and SNBT.

This project is derived from an earlier version of OpenNBT and contains various fundamental improvements and changes to it, including:

  • Most notably, move the tag name out the of tags themselves
  • SNBT for string serialization1
  • Add primitive getter methods to number types
  • Don't wrap values given in Tag#setValue / Tag constructors
  • NumberTag and NumberArrayTag interfaces for easier number handling
  • Don't use reflection when creating tag instances
  • Directly use value in copy(), also replacing clone()
  • Implement tag specific equals() methods
  • Update to Java 8
  • A bunch of other small improvements and fixes

Dependency

Maven:

<repository>
    <id>viaversion-repo</id>
    <url>https://repo.viaversion.com</url>
</repository>
<dependency>
    <groupId>com.viaversion</groupId>
    <artifactId>nbt</artifactId>
    <version>5.0.0</version>
</dependency>

Gradle:

repositories {
    maven("https://repo.viaversion.com")
}

dependencies {
    implementation("com.viaversion:nbt:5.0.0")
}

Building

Run mvn install in the source's directory via Maven.

License

ViaNBT is licensed under the MIT license.

Footnotes

  1. Includes code from adventure used for SNBT serialization. It works well enough, but if you need more accurate SNBT parsing across different Minecraft versions, you can use mcstructs, or Via's version of it using ViaNBT.

About

A library for dealing with Minecraft NBT.

Resources

License

Stars

Watchers

Forks

Languages