Fixed NBT writing being limited to 32 kB

The length of an NBT stream was limited to 32 kB because it was being
read as a short (2^15 bits).
The length is now limited to int.MaxValue, or 2^31 = 2GB, should be
enough :smile: