-
Notifications
You must be signed in to change notification settings - Fork 37
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
Papercut: nbt-serde always writes List tags as opposed to ByteArray/IntArray tags #27
Comments
The problem I encountered when writing this is that There were some limitations in the Serde API when I last looked into this, but I believe there is a new version of the library available with more flexibility. On a related note: it's nice to see that someone is using this library outside of the (all-but abandoned) Hematite project. One of the original motivations for breaking it out into its own crate was that it might be the most useful standalone library. |
It is an annoying part of the NBT specification that Other than the issue with I decided to use this project after I discovered it supported Serde in a separate crate. Initially, I didn't see the Serde support, and began to write my own NBT library that supported Serde. An issue that I see is that the two crates do very similar things, but are split up. The very high quality Another, unrelated note is that the "raw" module should be replaced with direct use of byteorder. In my abandoned crate, the ByteOrder was a type parameter of the serializer/deserializer which seamlessly allowed BE and LE support for Pocket Edition. |
The reason for the That said, I'd be happy to see better Byte/IntArray support, as well as little endian parsing, both become part of the serde-focused crate. It makes sense to me to prioritize writing into these formats over the generic lists for Unfortunately, it's just not realistic for me to claim I can be responsive to these feature requests in the near term -- this project has slipped down my priorty list, sadly. If you'd like to take a crack at it, I am extremely happy to review and merge PRs to this effect. Over the longer term, I would still like to come back to this project and clarify its scope/contents/documentation, and put it up on crates.io if possible. |
While you may view the nbt-serde crate as unfinished, it seems very functional to me aside from the array encoding issue. The issue with the duplication of code would best be resolved with a merge itself. For example, the serialization/deserialization for serde_json Glancing at the encoding code, adding IntArray/ByteArray support seems as easy as just adding detecting of Int or Byte tag types in the I'm currently busy on a different project, a world generator written in Rust. But, when I add support for saving chunks, I will likely have to put some work into this crate one way or another ;) |
Currently, an
&[i8]
or&[i32]
always results in nbt-serde writing a List tag. This is undesirable when trying to work with chunk files, as Minecraft only accepts IntArray/ByteArray. Another slightly unrelated bug is that serialize_bytes returns an error, instead of writing a ByteArray tag. Fixing both of these issues would make nbt-serde usable with Minecraft files. However, while it should still be possible to write a List tag with i8/i32 in some way, IntArray/ByteArray should be the default.Example of a papercut:
broken_chunk.zip
The text was updated successfully, but these errors were encountered: