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

loom {
    def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
    if (aw.exists()) {
        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')
        }
    }
}

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}"
    implementation 'org.jetbrains:annotations:24.0.1'

    modCompileOnly "maven.modrinth:sodium:mc1.21.1-${sodium_version}-fabric"
    modCompileOnly "maven.modrinth:iris:1.8.8+1.21.1-fabric"
    modCompileOnly "maven.modrinth:replaymod:1.21-2.6.20"
    modCompileOnly "maven.modrinth:flashback:0.32.0"
    modCompileOnly "maven.modrinth:cameratweaks:1.7.0-1.21.1"
//    modCompileOnly "maven.modrinth:yacl:3.6.3+1.21.1-fabric"

//    modRuntimeOnly "maven.modrinth:modmenu:11.0.3"
//    modRuntimeOnly "maven.modrinth:sodium:mc1.21.1-${sodium_version}-fabric"
//    modRuntimeOnly "maven.modrinth:iris:1.8.8+1.21.1-fabric"
//    modRuntimeOnly "maven.modrinth:replaymod:1.21-2.6.20"
//    modRuntimeOnly "maven.modrinth:cameratweaks:1.7.0-1.21.1"
//    modRuntimeOnly "maven.modrinth:yacl:3.6.3+1.21.1-fabric"

    include(api("gg.moonflower:molang-compiler:${molang_compiler_version}"))
    include(api("io.github.ocelot:glsl-processor:${glsl_processor_version}"))

    include(api("io.github.spair:imgui-java-binding:$imgui_version"))
    include(api("io.github.spair:imgui-java-lwjgl3:$imgui_version")) {
        exclude group: 'org.lwjgl'
        exclude group: 'org.lwjgl.lwjgl'
    }

    include(runtimeOnly("io.github.spair:imgui-java-natives-linux:$imgui_version"))
    include(runtimeOnly("io.github.spair:imgui-java-natives-macos:$imgui_version"))
    include(runtimeOnly("io.github.spair:imgui-java-natives-windows:$imgui_version"))
}
