plugins {
    id 'fabric-loom' version "${loom_version}"
    id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

base {
    archivesName = project.archives_base_name
}

repositories {
    mavenCentral()

    maven { url "https://maven.shedaniel.me" }
    maven { url "https://maven.architectury.dev" }
    maven { url "https://maven.blamejared.com" }

    maven {
        name = 'GeckoLib'
        url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
        content {
            includeGroupByRegex("software\\.bernie.*")
            includeGroup("com.eliotlash.mclib")
        }
    }

    maven { url "https://repo.spongepowered.org/maven" }
    maven { url "https://maven.terraformersmc.com" }
    maven { url "https://mvn.devos.one/releases/" }

    maven {
        url "https://maven.jamieswhiteshirt.com/libs-release"
        content { includeGroup "com.jamieswhiteshirt" }
    }

    maven {
        url "https://jitpack.io/"
        content { excludeGroup "io.github.fabricators_of_create" }
    }

    maven {
        name "patchouli"
        url "https://maven.blamejared.com"
    }
}

fabricApi {
    configureDataGeneration()
}

dependencies {
    minecraft "com.mojang:minecraft:${project.minecraft_version}"
    mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
    modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
    modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

    modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:12.0.684"
    modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:12.0.684"

    modImplementation "com.terraformersmc.terraform-api:terraform-wood-api-v1:7.0.1"
    include "com.terraformersmc.terraform-api:terraform-wood-api-v1:7.0.1"

    modImplementation("software.bernie.geckolib:geckolib-fabric-${minecraft_version}:${geckolib_version}")
    implementation("com.eliotlash.mclib:mclib:20")

    modImplementation "vazkii.patchouli:Patchouli:${patchouli_version}"
}

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

tasks.withType(JavaCompile).configureEach {
    it.options.release = 17
}

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

jar {
    from("LICENSE") {
        rename { "${it}_${project.base.archivesName.get()}" }
    }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
    repositories {
    }
}