plugins {
    id 'multiloader-loader'
    id 'net.fabricmc.fabric-loom'
    id "com.modrinth.minotaur" version "2.+"
}
repositories {
    maven { url "https://maven.shedaniel.me/" }
    maven { url "https://maven.terraformersmc.com/releases/" }
}

dependencies {
    minecraft "com.mojang:minecraft:${minecraft_version}"
    implementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
    implementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"

    //modApi "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config}"
    //modApi "com.terraformersmc:modmenu:${project.mod_menu}"

    include(implementation "org.yaml:snakeyaml:${project.YAML_snake}")
}

loom {
    def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
    if (aw.exists()) {
        accessWidenerPath.set(aw)
    }
    mixin {
        defaultRefmapName.set("${mod_id}.refmap.json")
    }
    runs {
        client {
            client()
            setConfigName('Fabric Client')
            ideConfigGenerated(true)
            runDir('runs/client')
        }
        server {
            server()
            setConfigName('Fabric Server')
            ideConfigGenerated(true)
            runDir('runs/server')
        }
    }
}

modrinth {
    token = System.getenv("MODRINTH_TOKEN")
    projectId = "rOrXjyPb" // https://modrinth.com/mod/bookshelf-inspector
    version = project.version
    versionType = project.versionType
    uploadFile = jar
    gameVersions = [project.minecraft_version]
    loaders = ["fabric"]
    if(project.versionType == "beta" || project.versionType == "alpha"){
        dependencies {
            required.project "fabric-api"
        }
    }else{
        dependencies {
            required.project "fabric-api"
            required.project "cloth-config"
            required.project "modmenu"
        }
    }
}