Skip to content
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

Boolean Primitive Writing #15

Closed
Offroaders123 opened this issue Nov 29, 2022 · 1 comment
Closed

Boolean Primitive Writing #15

Offroaders123 opened this issue Nov 29, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Offroaders123
Copy link
Owner

Offroaders123 commented Nov 29, 2022

Handling the JavaScript Boolean primitives as acceptable values when writing to raw NBT. They will be coerced to Byte tags first on the writing side, then also the reading side, so there will have to be a second layer to declare whether or not that key should be converted to a Boolean manually, or not. This is likely where the Minecraft type definitions and classes can handle that part of it.
*Edit: #6

@Offroaders123 Offroaders123 added the enhancement New feature or request label Nov 29, 2022
@Offroaders123 Offroaders123 self-assigned this Nov 29, 2022
@Offroaders123 Offroaders123 added bug Something isn't working and removed enhancement New feature or request labels Dec 8, 2022
@Offroaders123
Copy link
Owner Author

Supported! It was surprisingly easy to add, actually.

And a note about the last part of the issue message, you'd only have to convert the ByteTag to a boolean if you actually want the primitive true or false values back. If you type it as BooleanTag from the library, it can be any of the combinations that may happen, boolean | ByteTag<0 | 1>. So if you write your NBT object editing code to handle both boolean primitives, or the ByteTag value version, then you don't have to convert anything! It's still a boolean either way, just possibly not always the boolean primitive, specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant