plugins {
    id 'fabric-loom' version '1.11-SNAPSHOT'
}

version = project.mod_version
group = project.maven_group

base {
    archivesName = project.archives_base_name
}

repositories {
    mavenLocal()
    maven {
        name = 'BlameJared Maven (CrT / Bookshelf)'
        url = 'https://maven.blamejared.com'
    }
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}

loom {
    mods {
        "veil-example-mod" {
            sourceSet sourceSets.main
        }
    }
}

dependencies {
    // To change the versions see the gradle.properties file
    minecraft "com.mojang:minecraft:${project.minecraft_version}"
    mappings loom.officialMojangMappings()
    modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

    modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

    modImplementation("foundry.veil:veil-fabric-${project.minecraft_version}:${project.veil_version}") {
        exclude group: "maven.modrinth"
    }
    modRuntimeOnly "maven.modrinth:modmenu:11.0.3"

//    modRuntimeOnly "maven.modrinth:sodium:mc1.20.1-0.5.3"
}

processResources {
    inputs.property "version", project.version

    filesMatching("fabric.mod.json") {
        expand "version": project.version
    }
}

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

java {
    // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
    // if it is present.
    // If you remove this line, sources will not be generated.
    withSourcesJar()

    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

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