apply from: "https://raw.githubusercontent.com/Flemmli97/GradleScripts/arch-loom-v2/neoforge.gradle"

loom {
    runs {
        data {
            data()
            programArgs "--all", "--mod", "flan"
            programArgs "--output", project(":common").file("src/generated/resources").absolutePath
        }
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        name = "FTB"
        url = "https://maven.ftb.dev/releases"
    }
    maven {
        name = "CurseMaven"
        url "https://www.cursemaven.com"
    }
    maven {
        name = "minecolonies"
        url "https://ldtteam.jfrog.io/ldtteam/modding/"
    }
    maven {
        name = "LinguaBib"
        url "https://maven.blazing-coop.net/releases"
    }
}

dependencies {
    modCompileOnly dicemcmm

    //modRuntimeOnly "dev.ftb.mods:ftb-ranks-forge:${ftb_ranks}"
    //modRuntimeOnly "dev.ftb.mods:ftb-chunks-forge:${ftb_chunks}"

    //CompileOnly cause dependencies
    modCompileOnly "com.ldtteam:minecolonies:${minecolonies}"

    modImplementation include("io.github.flemmli97:lingua_bib:${lingua_bib}-neoforge")
}

task apiJar(type: Jar, dependsOn: classes) {
    archiveClassifier.set "api-source"
    from project(":common").sourceSets.main.output + sourceSets.main.output
    include "io/github/flemmli97/flan/api/**"
}

task remapApiJar(type: net.fabricmc.loom.task.RemapJarTask) {
    archiveClassifier.set "api"
    input.set apiJar.archiveFile
    addNestedDependencies = false
    dependsOn apiJar
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact(remapApiJar) {
                builtBy remapApiJar
            }
        }
    }
}
