plugins {
    id 'multiloader-loader'
    id 'net.neoforged.moddev'
    id "com.modrinth.minotaur" version "2.+"
}
repositories {
    maven { url "https://maven.shedaniel.me/" }
    mavenCentral()
}
neoForge {
    version = neoforge_version
    // Automatically enable neoforge AccessTransformers if the file exists
    def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
    if (at.exists()) {
        accessTransformers.from(at.absolutePath)
    }
    parchment {
        minecraftVersion = parchment_minecraft
        mappingsVersion = parchment_version
    }
    dependencies {
        api "me.shedaniel.cloth:cloth-config-neoforge:${cloth_config}"
    }

    runs {
        configureEach {
            systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
            ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
        }
        client {
            client()
        }
        data {
            clientData()
        }
        server {
            server()
        }
    }
    mods {
        "${mod_id}" {
            sourceSet sourceSets.main
        }
    }
}

dependencies {
    jarJar(implementation("org.yaml:snakeyaml:2.4")){}
    runtimeOnly "org.yaml:snakeyaml:2.4"
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

sourceSets.main.resources { srcDir 'src/generated/resources' }

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 = ["neoforge"]
    if(project.versionType == "beta" || project.versionType == "alpha"){
        dependencies {}
    }else{
        dependencies {
            required.project "cloth-config"
        }
    }
}