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
SNBT Float Types Formatting #36
Labels
bug
Something isn't working
Comments
Offroaders123
added a commit
that referenced
this issue
Nov 6, 2023
Discovered a bug with my SNBT output! Realized that it's actually 'mandatory' (I think?) for Float and Double tags to have a decimal point. I thought it was a bug in Tnze's SNBT extension for VSCode, but it was my misunderstanding as to what was required for those tags when displayed/viewed/edited in SNBT. I also just realized I need to add support for the `true` and `false` boolean keyword types. Those don't appear to be working either. https://github.com/Tnze/snbt-vscode https://static.wikia.nocookie.net/minecraft_de_gamepedia/images/e/e2/SNBT_data-Befehl.png/revision/latest https://minecraft.wiki/w/NBT_format#SNBT_format #36
|
Offroaders123
added a commit
that referenced
this issue
Nov 7, 2023
This is the real implementation for this. It actually didn't take too much to get it working! I'm not sure whether the SNBT parsing implementation should make it mandatory for Float and Double tags to have a decimal spot. Currently you don't need to have one for it to parse correctly. This change here now just ensures that the output SNBT will now always have decimal places for simple Float and Double values. #36 #38 #39 Offroaders123/Dovetail#5 https://stackoverflow.com/questions/175739/how-can-i-check-if-a-string-is-a-valid-number https://stackoverflow.com/questions/6134039/format-number-to-always-show-2-decimal-places (I thought it was going to be this one, but turns out it rounds the value, and forces the value to be within that length, unlike how I thought it was additive.) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed https://stackoverflow.com/questions/9838809/check-if-number-string-contains-decimal (I was going to use this next also, but then I realized that `Number.isInteger()` also covers the same thing, but with one less primitive type conversion, and a variable reference) https://www.youtube.com/watch?v=z1j3RI3ZpsQ (asmr :), sleepy programming made this commit message take longer to write than normal, was dozing off a little bit; man this time change is still hard, gaining an hour is hard too because when you want to go to bed/wake up, it's not time yet, so you have to wait another hour to get to your normal time)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: