plugins {
    id "com.github.johnrengelman.shadow" version "8.1.1"
}

cocoon {
    ide()
    forge()
}

repositories {
    maven { url = "https://modmaven.dev/" }
    flatDir {
        dir 'run/mods-dev'
    }
}

dependencies {
    forge "net.minecraftforge:forge:${rootProject.forge_api_version}"

    //modCompileOnly "com.sk89q.worldedit:worldedit-core:7.2.5-SNAPSHOT"

    //modLocalRuntime "com.sk89q.worldedit:worldedit-mod:7.2.5-dist"
    //modApi "noppes.npcs:CustomNPCs:1.16.5.20220622snapshot"
    //modLocalRuntime "org.samo_lego:taterzens:1.9.6-forge"
    //modLocalRuntime "net.optifine:OptiFine:1.18.2_HD_U_H9_pre3_MOD:deobf"

    //modCompileOnly "maven.modrinth:cristel-lib:1.1.5-forge"
    //modLocalRuntime "maven.modrinth:cristel-lib:1.1.5-forge"

    //modLocalRuntime "maven.modrinth:sqlite-jdbc:3.41.2.1+20230506"
    //modLocalRuntime "maven.modrinth:mysql-jdbc:8.0.33+20230506"

    modOptionalCompileOnly project.jei_api_version
    modOptionalCompileOnly project.epicfight_api_version
    modOptionalCompileOnly project.curios_api_version
    modOptionalCompileOnly project.tacz_api_version

    modOptionalCompileOnly project.travelersbackpack_api_version
    modOptionalCompileOnly project.mrcrayfishbackpack_api_version
    modOptionalCompileOnly project.sophisticatedbackpack_api_version
    modOptionalCompileOnly project.ryoamicLights_api_version
    modOptionalCompileOnly project.lambdynamiclights_api_version

    // modOptionalApi 'curse.maven:mine-mine-no-mi-78726:4181345'
    //modOptionalApi 'moe.plushie.armourers_workshop:armourersworkshop-plugin-mod:1.0.3'

    testImplementation "org.junit.jupiter:junit-jupiter:5.10.0"
    testImplementation "org.junit.jupiter:junit-jupiter-engine:5.10.0"
    testImplementation "org.junit.platform:junit-platform-launcher:1.10.2"
}

processResources {
    inputs.property "version", project.version
    inputs.property "required_forge_api_version", project.required_forge_api_version
    inputs.property "required_forge_loader_version", project.required_forge_loader_version
    inputs.property "required_minecraft_version", project.required_minecraft_version

    filesMatching("META-INF/mods.toml") {
        expand inputs.properties
    }

    // in 1.21, the neoforge provides c item tags. so we don't need reset it.
    exclude "data/c/tags/item/**/*.json"
}

shadowJar {
    exclude "fabric.mod.json"
    exclude "architectury.common.json"

    //relocate 'gg.moonflower', 'moe.plushie.armourers_workshop.runtime'
}

runClientTest {
    selectPackage("moe.plushie.armourers_workshop.gametest.common")
    selectPackage("moe.plushie.armourers_workshop.gametest.client")
    selectPackage("moe.plushie.armourers_workshop.gametest.forge.common")
    selectPackage("moe.plushie.armourers_workshop.gametest.forge.client")
}

runServerTest {
    selectPackage("moe.plushie.armourers_workshop.gametest.common")
    selectPackage("moe.plushie.armourers_workshop.gametest.server")
    selectPackage("moe.plushie.armourers_workshop.gametest.forge.common")
    selectPackage("moe.plushie.armourers_workshop.gametest.forge.server")
}

publishing {
    publications {
        mavenForge(MavenPublication) {
            artifactId = rootProject.archives_base_name + "-" + project.name
            from components.java
        }
    }

    // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
    repositories {
        // Add repositories to publish to here.
    }
}