In the minecraft net source code there is a "quick exit" during 0x00 reads for base NBT objects.
private static Tag readUnnamedTag(DataInput dataInput, int n, NbtAccounter nbtAccounter) throws IOException {
byte by = dataInput.readByte();
if (by == 0) {
return EndTag.INSTANCE;
}
StringTag.skipString(dataInput);
try {
return TagTypes.getType(by).load(dataInput, n, nbtAccounter);
// omitted
}
Here we see that when the tag is 0x00 it won't read a header - and instead exit early with a "blank object", we should replicate this behavior when we have an object with nothing to serialize. This is especially helpful for "empty" nbt tags.
In the minecraft net source code there is a "quick exit" during
0x00
reads for base NBT objects.Here we see that when the tag is
0x00
it won't read a header - and instead exit early with a "blank object", we should replicate this behavior when we have an object with nothing to serialize. This is especially helpful for "empty" nbt tags.