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

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        name = 'Fabric-Permission-API'
        url 'https://oss.sonatype.org/content/repositories/snapshots'
    }
    maven {
        name = "Gunpowder"
        url = "https://maven.martmists.com/releases"
    }
    maven {
        name = 'Ladysnake Mods'
        url = 'https://maven.ladysnake.org/releases'
        content {
            includeGroup 'io.github.ladysnake'
            includeGroupByRegex 'io\\.github\\.onyxstudios.*'
        }
    }
    maven {
        name = "HavenKing"
        url = "https://hephaestus.dev/release"
    }
    maven {
        name = "FTB"
        url = "https://maven.ftb.dev/releases"
    }
    maven {
        name = "CurseMaven"
        url "https://www.cursemaven.com"
    }
    maven { url = "https://jitpack.io" }
    maven {
        url = "https://maven.jamieswhiteshirt.com/libs-release/"
        content {
            includeGroup 'com.jamieswhiteshirt'
        }
    }
    maven { url "https://maven.nucleoid.xyz/" }
    maven {
        name = "LinguaBib"
        url "https://maven.blazing-coop.net/releases"
    }
}

dependencies {
    modImplementation "me.lucko:fabric-permissions-api:${fabric_permissions_api}"

    modImplementation (octo_economy_api) {
        exclude group: "net.fabricmc.fabric-api"
    }
    modCompileOnly diamond_economy

    modCompileOnly "io.github.ladysnake:PlayerAbilityLib:${player_ability_lib}"

    //modRuntimeOnly "dev.ftb.mods:ftb-ranks-fabric:${ftb_ranks}"
    //modRuntimeOnly "dev.ftb.mods:ftb-chunks-fabric:${ftb_chunks}"
    //CompileOnly cause too many dependency
    modCompileOnly goml_reserved
    modCompileOnly "com.jamieswhiteshirt:rtree-3i-lite-fabric:0.3.0"

    modCompileOnly harvest_with_ease_fabric
    modCompileOnly "eu.pb4:common-protection-api:${common_prot_api}"

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

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/**"
    include "fabric.mod_api.json" //Include this so it gets remapped as a dependency
    rename("fabric.mod_api.json", "fabric.mod.json")
}

task remapApiJar(type: net.fabricmc.loom.task.RemapJarTask) {
    archiveClassifier.set "api"
    input.set apiJar.archiveFile
    addNestedDependencies = false
    dependsOn apiJar
    from sourceSets.main.output
    /* Putting it here doesnt seem to work...
    include "fabric.mod_api.json" //Include this so it gets remapped as a dependency
    rename("fabric.mod_api.json", "fabric.mod.json")
    */
}

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