You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are currently three different ways that NBT can be serialized:
Format
Endianness
VarInt
Java
Big
None
Bedrock (file)
Little
None
Bedorck (network)
Little
Yes. Sometimes they are ZigZag encoded using the ProtoBuf style, other times not.
I will reserve disparaging Microsoft for needlessly complicating one of the most simple serialization formats in existence. It is par for the course, and not even unexpected anymore. I would be more surprised if they didn't mess it up.
Regardless, the TagReader and TagWriter class accounts for all scenarios using the format options passed to its constructor. While this works in practice, it means most methods have to do additional checks to see what the appropriate way to read the data is.
Proposal
Make TagReader and TagWriter abstract, with a factory method to create an instance. Internally these different ways of reading/writing can be split into separate classes that do not require any runtime checks.
Problem
There are currently three different ways that NBT can be serialized:
I will reserve disparaging Microsoft for needlessly complicating one of the most simple serialization formats in existence. It is par for the course, and not even unexpected anymore. I would be more surprised if they didn't mess it up.
Regardless, the
TagReader
andTagWriter
class accounts for all scenarios using the format options passed to its constructor. While this works in practice, it means most methods have to do additional checks to see what the appropriate way to read the data is.Proposal
Make
TagReader
andTagWriter
abstract, with a factory method to create an instance. Internally these different ways of reading/writing can be split into separate classes that do not require any runtime checks.Something akin to this psuedo-code:
The actual implementations can be completely transparent and need not even be part of the public API.
The text was updated successfully, but these errors were encountered: