SpongePowered / nbt

Named Binary Tag (NBT) library for Java based on Graham Edgecombe's JNBT library. NBT is a tag based binary format designed to carry large amounts of binary data with smaller amounts of additional data.
https://flow.github.io/nbt
MIT License
50 stars 33 forks source link

Support the long array tag #10

Open jamierocks opened 6 years ago

jamierocks commented 6 years ago

This tag was introduced with MC 1.12.

This should address #9.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+2.6%) to 16.196% when pulling f0438cde0128d53f426d003f15db0315d9f1374f on jamierocks:feature/long-array into 7a1b6d986e6fbd01862356d47827b8b357349a22 on flow:develop.

piegamesde commented 6 years ago

Took me hours to find it, but you have a copy/paste error: case TAG_LONG_ARRAY: length = is.readInt(); long[] longs = new long[length]; for (int i = 0; i < length; i++) { longs[i] = is.readInt(); // <-- HERE } return new LongArrayTag(name, longs);

Lesson learned, I will look if I can improve the error messages when reading ill-formed NBT. "Tag type id " + id + " is unknown!" is not very helpful if you don't know where the error comes from

jamierocks commented 6 years ago

Oops. Will correct that, thanks for pointing it out :+1:.

SebastianCelejewski commented 6 years ago

I am really looking forward for this pull request to be merged.

kashike commented 6 years ago

@SebastianCelejewski You'd be better off using a different library.

piegamesde commented 6 years ago

@SebastianCelejewski @kashike I am trying to maintain this library in my fork. It is not a "hard" fork though, so if you want to use it with Maven you need jitpack.io: https://jitpack.io/#piegamesde/nbt/

But if I see other people are using it, I will try to make a proper release on Maven.

Currently, I've merged the long tag branch and added some library functionality to deal with region files and reading worlds in 1.13.

kashike commented 6 years ago

You'd still be better off using a different library, in my opinion. This one isn't that great at all compared to other libraries around.

SebastianCelejewski commented 6 years ago

I've been using this library for some time for my Minecraft plugins. I discovered problem with arrays of longs when I was upgrading my stuff to 1.13. I manually injected this pull request into my local fork, recompiled successfully, and it works fine. I don't need other library, this is just fine.

piegamesde commented 6 years ago

@kashike Do you have any suggestion of what to use instead? I only use this one because it's the best one I could find.

kashike commented 6 years ago

I'm a bit biased since I have my own (https://github.com/KyoriPowered/nbt), but you can look through https://github.com/topics/nbt?l=java.