Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 944 Bytes

README.md

File metadata and controls

41 lines (36 loc) · 944 Bytes

NBT

Simple yet powerful library for serializing and deserializing data in NBT format.

Dependency

<repositories>
    <repository>
        <id>tommyjs-repo</id>
        <url>https://repo.tommyjs.dev/repository/maven-releases</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>dev.tommyjs</groupId>
        <artifactId>nbt</artifactId>
        <version>2.0.1</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Examples

FileInputStream stream = new FileInputStream("bigtest.nbt");
GZIPInputStream gis = new GZIPInputStream(stream);
CompoundTag tag = Nbt.getApi().read(gis);
System.out.println(tag);
Tag tag = ...
byte[] binData = Nbt.getApi().serialize(tag);
System.out.println(Arrays.toString(binData));
byte[] data = ...
CompoundTag tag = Nbt.getApi().deserialize(data);
System.out.println(tag.getInt("MyIntegerField"));