Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read mcstructure file (it is nbt file) #5

Closed
phamtuongvan opened this issue May 5, 2022 · 2 comments
Closed

Can't read mcstructure file (it is nbt file) #5

phamtuongvan opened this issue May 5, 2022 · 2 comments

Comments

@phamtuongvan
Copy link

Bedrock .mcstructure files structure https://gist.github.com/tryashtar/87ad9654305e5df686acab05cc4b6205

@spnda
Copy link
Owner

spnda commented May 5, 2022

I think this is because Bedrock NBT uses little endian and the code currently assumes big endian at all time. I will look to see if I can detect or make some additions to the API for endianness. Thanks for the report.

@spnda
Copy link
Owner

spnda commented May 5, 2022

I've changed the API slightly so you can now do the following:

var reader = NbtReader.fromFile(file.path);
reader.setEndianness = Endian.little; // Depends whether Java or Bedrock
reader.read();

The same can be done with NbtWriter. Detecting the endianness is nearly impossible and can't be done accurately with NBT files. You will need to "guess" based on what NBT file it is. However, I couldn't find a .mcstructure to test this with, so I'd love if you could test if it now works for you!

Thank you for your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants