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

cocoon {
    ide()
    fabric()
}

repositories {
    flatDir {
        dir 'run/mods-dev'
    }
}

dependencies {
    modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
    modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"

    modImplementation 'me.lucko:fabric-permissions-api:0.3.1'

    modShadow "com.electronwill.night-config:core:${project.night_config}"
    modShadow "com.electronwill.night-config:toml:${project.night_config}"

    modOptionalCompileOnly project.trinkets_api_version

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

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

//    modLocalRuntime "net.coderbot.iris:iris:mc1.18.2-1.3.1"
//    modLocalRuntime "me.jellysquid.mods.sodium:sodium:fabric-mc1.18.2-0.4.1+build.15"

    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_fabric_api_version", project.required_fabric_api_version
    inputs.property "required_fabric_loader_version", project.required_fabric_loader_version
    inputs.property "required_minecraft_version", project.required_minecraft_version

    filesMatching("fabric.mod.json") {
        expand inputs.properties
    }
}

shadowJar {
    exclude "architectury.common.json"

    //relocate 'gg.moonflower', 'moe.plushie.armourers_workshop.runtime'
    relocate 'com.electronwill', '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.fabric.common")
    selectPackage("moe.plushie.armourers_workshop.gametest.fabric.client")
}

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

publishing {
    publications {
        mavenFabric(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.
    }
}

repositories {
    mavenCentral()
}
