NBT
NBT copied to clipboard
Add a serializer flag to force ordering of TAG_Compound keys
It may be desirable to keep an encoded binary cache of an NBT tree, to be able to do fast bytewise comparison (such comparisons are vectorizable, and as such, considerably faster than making many thousands of equals() method calls).
However, this is currently not a reliable method of comparison, since TAG_Compounds with the same contents can have said contents ordered differently. This doesn't affect the usability of the data in the end, but it does mean that the binary representation would be different.
Use case: I want to have a fast way to compare itemstack NBT when checking item equivalence.