ljfa-ag / libnbtplusplus Goto Github PK
View Code? Open in Web Editor NEWA C++ library for Minecraft's file format NBT
License: GNU Lesser General Public License v3.0
A C++ library for Minecraft's file format NBT
License: GNU Lesser General Public License v3.0
Like Cppunit
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.
Hello, I started using this library in MultiMC, but had to make some changes:
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
Minecraft 1.13 adds a new NBT LongArray tag which stores 64-bit signed integer arrays, which aren't yet supported by the library
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:
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.
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.
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.
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.
Especially the bad_cast exceptions should get more meaningful messages
please. as title, I got "fatal error: 'nbt_export.h' file not found" error.
CMake:
In file included from ...nbt_tags.h:20:
In file included from ...tag_primitive.h:23:
In file included from ...crtp_tag.h:23:
...tag.h:26:10: fatal error: 'nbt_export.h' file not found
so i cannot compile it, is that common? I am confuse..
For now libraries like Boost::Iostreams or Gzstream can be used for that purpose.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.