plugins {
    id "architectury-plugin" version "3.4-SNAPSHOT"
    id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
}

repositories {
}

ext {
    build16 = (System.getProperty("build16") != null && System.getProperty("build16"))
}

architectury {
    minecraft = build16 ? rootProject.minecraft_version_16 : rootProject.minecraft_version
}

subprojects {
    apply plugin: "dev.architectury.loom"

    loom {
        silentMojangMappingsLicense()
    }

    dependencies {
        minecraft "com.mojang:minecraft:${build16 ? rootProject.minecraft_version_16 : rootProject.minecraft_version}"
        // The following line declares the mojmap mappings, you may use other mappings as well
        mappings loom.officialMojangMappings()
        // The following line declares the yarn mappings you may select this one as well.
        // mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
    }
}

allprojects {
    apply plugin: "java"
    apply plugin: "architectury-plugin"
    apply plugin: "maven-publish"

    archivesBaseName = rootProject.archives_base_name + "-" + project.name
    version = rootProject.mod_version
    group = rootProject.maven_group

    repositories {
        maven { url 'https://jitpack.io' }
    }

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

    java {
        withSourcesJar()
    }

    jar {
        from rootProject.file("LICENSE")
    }

    if (build16) {
        archivesBaseName += "-pre1.17"
    } else {
        archivesBaseName += "-1.17+"
    }
}
