2021-12-04 20:53:49 +03:00
2019-09-05 08:22:25 +00:00
2021-09-28 16:08:55 +00:00
2021-12-04 20:53:49 +03:00
2021-12-04 20:53:49 +03:00
2019-09-05 08:22:25 +00:00
2021-12-04 20:53:49 +03:00
2019-09-05 08:22:25 +00:00
2019-10-11 10:14:41 +00:00
2019-09-05 08:22:25 +00:00
2020-08-16 17:43:25 +00:00
NBT
2020-08-16 17:41:33 +00:00
NBT
2020-08-16 17:41:33 +00:00

NBT library for C++17

You can read and save files in NBT format with this library. It supports different formats: NBT Java Edition, NBT Bedrock Edition (both network and file formats) and Mojangson.

Usage

#include <nbt.hpp>
#include <fstream>

using namespace nbt;

int main() {
    std::ifstream input("java.nbt");
    tags::compound_tag root;
    input >> contexts::java >> root;
    std::ofstream output("mojangson.txt");
    output << contexts::mojangson << root;
}

By default all lists have their own specialization for each tag. If you want to get something simple like std::vector<nbt::tags::tag> as list values you can use nbt::tags::tag_compound::make_heavy and nbt::tags::list_tag::as_tags. After that all lists in NBT subtree would be nbt::tags::tag_list_tag objects.

NBTC

There are also a simple converter between NBT formats: nbtc.

./nbtc FROM TO

Parameters:

  • FROM read stdin as FROM NBT format
  • TO write NBT tag to stdout as TO format

NBT formats:

  • java Minecraft Java Edition NBT
  • bedrock or bedrock-disk Minecraft Bedrock Edition storage NBT format
  • bedrock-net Minecraft Bedrock Edition network NBT format
  • mojangson text NBT representation
  • kbt HandTruth NBT extension
Description
NBT C++ Library (forked from https://github.com/handtruth/nbt-cpp)
Readme MIT 64 KiB
Languages
C++ 94.1%
Meson 2.7%
Nix 2.7%
Dockerfile 0.5%