-
Notifications
You must be signed in to change notification settings - Fork 48
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
Strings with the literal values "true" and "false" are mistaken with bytes when written and parsed from SNBT. #63
Comments
Bumping this, because I also experience this. At the moment, I have to use a custom static method to convert bytes into strings, but it would be safer if the issue was fixed at the source. |
I'm guessing this project has been abandoned. It's 3-1/2 years since this issue was originally posted and there's been no fix. I, too, have been bitten by the "true" => 1b issue. querz-nbt is an ever-so-slightly more recent fork of this project but it, too, suffers from the exact same bug. The NBT => SNBT => NBT workflow is critical for what I'm doing and it remains broken. |
I haven't used this library in ages, but that sounds like a wild corruption bug to go unnoticed for so long.
As far as I'm aware my fork isn't necessarily "more recent", though there are branches with #91 and #97. You're welcome to submit a fix to my fork, but you might be interested in @ens-gijs's fork that grew out of #68 instead. I haven't used it myself (yet), but as far as I can tell it's been steadily improving upon (and diverging from) this library |
It seems to happen at these location ... querz/SNBTParser.java, lines 117 and 119 querz-nbt/SNBTParser.java, lines 243 and 246 The incoming NBT has a I'll definitely look into those other forks; thanks! As an aside - and I'm conflating issues here - for whatever reason, the compressed file produced by |
If you have a string tag with the value "true" or "false" and you write it to SNBT, it's read as a byte when parsed again. This is problematic when trying to manipulate gamerules using SNBT.
Potential fix is to check if a string matches "true" or "false" when writing to SNBT and surround it with quotes if it does.
The text was updated successfully, but these errors were encountered: