Skip to content

feat(nbt): TagStringIO Enhancements #1239

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

Merged
merged 4 commits into from
Jun 17, 2025

Conversation

kermandev
Copy link
Contributor

Motivation

Since adventure release 4.21.0, users can now write any BinaryTag to a String; that left a gap in reading them.
There is also another case where it may be useful to capture the rest of the string, for example, in a command argument. (Otherwise, users would have to group count)

So this commit:

  • Adds support to read any BinaryTag (disallows trailing like the Compound version)
  • Use a writer for any BinaryTag
  • Adds support for reading embedded any BinaryTag, and CompoundBinaryTag (Allows trailing data, through passed Appendable)
  • Adds support to CharBuffer to take the rest of the buffer.

Whats with the special cases for CompoundBinaryTag a child of BinaryTag?

The special cases exist for compound methods, so you can immediately throw on the first failed parsing token, even though BinaryTags can represent a Compound; I did think about doing this through a functional interface because functions don't support checked throws, but this is more complex than it needs to be. (This wouldn't even be exposeable)

kermandev added 3 commits June 7, 2025 21:56
Since adventure release 4.21.0, users can now write any BinaryTag to a String; that left a gap reading them.
There is also another case where it may be useful to capture the rest of the string, for example, in a command argument. (Otherwise users would have to group count)
So this commit:
 * Adds support to read any BinaryTag (disallows trailing like the Compound version)
 * Use a writer for any BinaryTag
 * Adds support for reading embedded any BinaryTag, and CompoundBinaryTag (Allows trailing data, through passed Appendable)
 * Adds support to CharBuffer to take the rest of the buffer.
The special cases exist for compound methods so you can immediately throw on the first failed parsing token, even know BinaryTag's can represent a Compound
@kezz kezz dismissed zml2008’s stale review June 17, 2025 10:01

addressed

@kezz kezz enabled auto-merge June 17, 2025 10:05
@kezz kezz added this pull request to the merge queue Jun 17, 2025
Merged via the queue into KyoriPowered:main/4 with commit 00c0e7c Jun 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants