plugins {
    id 'multiloader-loader'
    id 'net.neoforged.moddev'
    id "com.modrinth.minotaur" version "2.+"
}

repositories {
    maven { url 'https://api.modrinth.com/maven' }
}

apply plugin: 'com.modrinth.minotaur'
modrinth {
    token = System.getenv("MODRINTH_TOKEN")
    projectId = "async"
    versionNumber = project.version
    versionName = project.version
    versionType = "alpha"
    uploadFile = fileTree(dir: "${project.buildDir}/libs", include: "*.jar").files.find()
    gameVersions = ["1.21.6", "1.21.7", "1.21.8"]
    loaders = ["neoforge"]
    dependencies {
        optional.project "lithium"
        optional.project "c2me-neoforge"
        incompatible.project "moonrise-opt"
    }
    changelog = """
"""
}

neoForge {
    version = neoforge_version
    // Automatically enable neoforge AccessTransformers if the file exists
    def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
    if (at.exists()) {
        accessTransformers.from(at.absolutePath)
    }
    parchment {
        minecraftVersion = parchment_minecraft
        mappingsVersion = parchment_version
    }
    runs {
        configureEach {
            systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
            ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
        }
        client {
            client()
        }
        server {
            server()
        }
    }
    mods {
        "${mod_id}" {
            sourceSet sourceSets.main
        }
    }
}

dependencies {
    compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:${mixinsquared_version}"))
    implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-neoforge:${mixinsquared_version}"))
    implementation 'maven.modrinth:lithium:mc1.21.8-0.18.0-neoforge'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'
}

sourceSets.main.resources { srcDir 'src/generated/resources' }