import org.gradle.api.tasks.SourceSetContainer

plugins {
    id("net.fabricmc.fabric-loom") version "1.17.20"
    `maven-publish`
}

base {
    archivesName.set("bglands-client-fabric")
}

version = "2.0.0"

dependencies {
    minecraft("com.mojang:minecraft:26.2")
    implementation("net.fabricmc:fabric-loader:0.19.3")
    implementation("net.fabricmc.fabric-api:fabric-api:0.158.0+26.2")
}

// The protocol stays independently testable while its classes are compiled
// directly into the distributable Fabric jar (no second jar to install).
extensions.getByType<SourceSetContainer>().named("main") {
    java.srcDir(project(":java-client-common").file("src/main/java"))
}

tasks.processResources {
    inputs.property("version", project.version)
    filesMatching("fabric.mod.json") {
        expand("version" to project.version)
    }
}

tasks.withType<JavaCompile>().configureEach {
    options.release.set(25)
    options.encoding = "UTF-8"
}

java {
    sourceCompatibility = JavaVersion.VERSION_25
    targetCompatibility = JavaVersion.VERSION_25
    withSourcesJar()
}
