Coder Social home page Coder Social logo

libnbtplusplus's Introduction

This repository is not being maintained anymore, please refer to one of the active forks instead, for example PrismLauncher/libnbtplusplus.

libnbt++ 2

libnbt++ is a free C++ library for Minecraft's file format Named Binary Tag (NBT). It can read and write compressed and uncompressed NBT files and provides a code interface for working with NBT data.


libnbt++2 is a remake of the old libnbt++ library with the goal of making it more easily usable and fixing some problems. The old libnbt++ especially suffered from a very convoluted syntax and boilerplate code needed to work with NBT data.

libnbtplusplus's People

Contributors

ljfa-ag avatar minexew avatar peterix avatar robertleahy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libnbtplusplus's Issues

Little endian negative long encoding doesn't match Minecraft

I've found that Minecraft Bedrock Edition encodes negative little endian longs different than expected:
For example, creating a level with seed -123456789 will encode it in level.dat as EB 32 A4 F8 00 00 00 00, which is read by this library as 4171510507.
The same can be seen with the worldStartCount value in level.dat, on a newly generated world it's encoded as FE FF FF FF 00 00 00 00, apparently meaning -2.

With positive values, such as any positive seed, or the timestamp in LastPlayed it seems to work correctly, presumably because they values themselves aren't bigger than 32-bit.

tl;dr:

name value in level.dat read by minecraft read by libnbtplusplus correct?
RandomSeed EB32A4F800000000 -123456789 4171510507 πŸ‘Ž
RandomSeed 15CD5B0700000000 123456789 123456789 πŸ‘
worldStartCount FEFFFFFF00000000 -2? 4294967294 πŸ‘Ž
LastPlayed CF94015B00000000 2018-05-20 1526830287 πŸ‘

This is based on level.dat files from different versions of Minecraft 1.2 to 1.4 for iOS and Windows 10.
It seems Minecraft is treating the 64-bit long as 32-bit, and ignoring the rest, it seems related to this minecraft bug: https://bugs.mojang.com/browse/MCPE-7091?jql=text%20~%20%22TAG_Long%22, which was ultimately resolved by limiting the seed to 32 bits.

Make some functions inline

Right now, most functions are defined in source files, even if they're small, preventing the compiler from inlining them. Link-time optimization is not guaranteed, so some of the definitions should maybe be moved to the header files.

Support for long arrays

Minecraft 1.13 adds a new NBT LongArray tag which stores 64-bit signed integer arrays, which aren't yet supported by the library

Documentation & Conan support

Hi,
I'd really love to use your library but I'm stopped by the fact it lacks of documentation and I'm struggling also including it in my Conan project.

I'm willing to do the dirty job to post your lib on Conan Center, but I'd like to know if the version that is currently on master is working without any issue and could be defined as 1.0, or should I pick the branch called v1.

I will manage to understand the library by just reading the code, but for future users it would be helpful to have a minimalist documentation.

Requires documentation

While this is a resourceful tool, I can’t find anything that lets me know how to use it. I’m not sure how to write or read NBT files either.

Incorporate changes done in a manual fork

Hello, I started using this library in MultiMC, but had to make some changes:

  • Make it a shared library instead of a static one (because of LGPL)
  • Fix build on OSX and Windows because of the above
  • Make the build system a bit more adapted to MultiMC integration

I'll try to get it into a decent repo again so you can use it.

See tracking issue on my end:
MultiMC/Launcher#1229

6 CxxTests fail

I ran CxxTest on the LibNBT++ library, but 6 of the 34 tests fail. The files appear to be read correctly as no file-related exceptions appear to be thrown, however the data returned does not meet the assertions in those tests.

These are the tests that failed:

  • endian_str_test::test_uint
  • read_test::test_read_bigtest
  • read_test::test_read_littletest
  • zlibstream_test::test_inflate_zlib
  • zlibstream_test::test_inflate_open
  • zlibstream_test::test_deflate_closed

I am using Windows 8, Visual Studio Community 2019, CxxTest 4.4, and zlib 1.2.11.

Here is the full log from running those tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.