To write generic code for all versions, use the mystery-mod-addon as source set for that. If you want to use version specific code, then use the version module.