optimize writing to NBT tags