plugins {
    id 'multiloader-loader'
    id 'fabric-loom'
}

repositories {
    mavenLocal()
    maven {
        name = "Terraformers"
        url = "https://maven.terraformersmc.com/"
    }
    maven {
        name = "Architectury Maven"
        url = uri("https://maven.architectury.dev/")
    }
}

dependencies {
    minecraft "com.mojang:minecraft:${minecraft_version}"
    mappings loom.layered {
        officialMojangMappings()
        parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_version}@zip")
    }
    modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
    modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"

    modImplementation("io.ejekta.kambrik:kambrik-fabric:${kambrik_version}")
    modImplementation("io.ejekta.percale:percale-fabric:${percale_version}")

    modImplementation("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}")

    modImplementation "com.terraformersmc:modmenu:${mod_menu_version}"
    modImplementation "net.fabricmc:fabric-language-kotlin:1.12.3+kotlin.2.0.21"
}

loom {
    def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
    if (aw.exists()) {
        println("Loaded access widener $aw")
        accessWidenerPath.set(aw)
    }
    mixin {
        defaultRefmapName.set("${mod_id}.refmap.json")
    }
    runs {
        client {
            client()
            setConfigName('Fabric Client')
            ideConfigGenerated(true)
            runDir('runs/client')
        }
        server {
            server()
            setConfigName('Fabric Server')
            ideConfigGenerated(true)
            runDir('runs/server')
        }
    }
}
