apply from: "https://raw.githubusercontent.com/Fuzss/modresources/main/gradle/${libs.versions.minecraft.get()}/fabric.gradle"

configurations {
    commonNeoForgeApi
    shadowCommonNeoForgeApi
    commonForgeApi
    shadowCommonForgeApi
    compileClasspath.extendsFrom common, commonNeoForgeApi, commonForgeApi
    runtimeClasspath.extendsFrom common, commonNeoForgeApi, commonForgeApi
    developmentFabric.extendsFrom common, commonNeoForgeApi, commonForgeApi
}

dependencies {
    // Common Project
    commonNeoForgeApi(project(path: ":Common-NeoForgeApi", configuration: "namedElements")) { transitive false }
    shadowCommonNeoForgeApi(project(path: ":Common-NeoForgeApi", configuration: "transformProductionFabric")) { transitive false }
    commonForgeApi(project(path: ":Common-ForgeApi", configuration: "namedElements")) { transitive false }
    shadowCommonForgeApi(project(path: ":Common-ForgeApi", configuration: "transformProductionFabric")) { transitive false }

    // Fabric Api
    modApi libs.fabricapi.fabric

    // Night Config
    api(include(libs.nightconfigcore.get()))
    api(include(libs.nightconfigtoml.get()))

    // Puzzles Lib
//    modApi libs.puzzleslib.fabric

    // Mod Menu
    modCompileOnly(libs.modmenu.fabric) { transitive = false }
    modLocalRuntime(libs.modmenu.fabric) { transitive = false }
}

shadowJar {
    configurations = [project.configurations.shadowCommon, project.configurations.shadowCommonNeoForgeApi, project.configurations.shadowCommonForgeApi]
}

sourcesJar {
    def commonNeoForgeApiSources = project(":Common-NeoForgeApi").sourcesJar
    dependsOn commonNeoForgeApiSources
    from commonNeoForgeApiSources.archiveFile.map { zipTree(it) }
    def commonForgeApiSources = project(":Common-ForgeApi").sourcesJar
    dependsOn commonForgeApiSources
    from commonForgeApiSources.archiveFile.map { zipTree(it) }
}
