RyanHub - file viewer
filename: fabric/build.gradle
branch: 1.21
back to repo
plugins {
    id 'com.github.johnrengelman.shadow'
}

architectury {
    platformSetupLoomIde()
    fabric()
}

loom {
    accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}

configurations {
    common {
        canBeResolved = true
        canBeConsumed = false
    }
    compileClasspath.extendsFrom common
    runtimeClasspath.extendsFrom common
    developmentFabric.extendsFrom common

    // Files in this configuration will be bundled into your mod using the Shadow plugin.
    // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
    shadowBundle {
        canBeResolved = true
        canBeConsumed = false
    }
}

repositories {
    flatDir {
        dir './libs'
    }
}

dependencies {
    modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"

    // Fabric API. This is technically optional, but you probably want it anyway.
    modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"

    // Architectury API. This is optional, and you can comment it out if you don't need it.
    modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
    // because gradle is stupid and my local setup is broken somewhere but deleting the cache doesnt seem to fix it

    common(project(path: ':common', configuration: 'namedElements')) { transitive false }
    shadowBundle project(path: ':common', configuration: 'transformProductionFabric')

    // Energy API
    include modApi("teamreborn:energy:4.1.0") {
        transitive = false
    }

    // yes yes all this needs to be cleaned up and properly versioned, but I'm waiting to clean up the CSL mess first

    // owo lib
    modImplementation "io.wispforest:owo-lib:0.12.11+1.21"

    // geckolib
    modImplementation "software.bernie.geckolib:geckolib-fabric-1.21.1:4.6.6"

    // JADE (needed for addon)
    modImplementation "curse.maven:jade-324717:5639994"

    // athena (CTM)
    modRuntimeOnly "earth.terrarium.athena:athena-fabric-1.21:4.0.0"

    // recipe viewer runtime
    switch (recipe_viewer.toLowerCase(Locale.ROOT)) {
        case "emi": modRuntimeOnly "dev.emi:emi-fabric:${emi_version}"; break
        case "rei": modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:16.0.754"; break
        case "jei": modRuntimeOnly "mezz.jei:jei-1.21.1-fabric:19.21.0.245"
        case "disabled": break
        default: println("Unknown recipe viewer specified: ${recipe_viewer}. Must be EMI, REI, JEI, or disabled.")
    }

    // mod menu
    modImplementation "com.terraformersmc:modmenu:11.0.3"

    // oracle index
    modRuntimeOnly "curse.maven:oracle-index-1206582:6300146"
    implementation "org.jsoup:jsoup:1.17.2"

    // compat mods for testing
//    // Tech Reborn
    modImplementation "curse.maven:techreborn-233564:5608205"
    modImplementation "curse.maven:reborncore-237903:5608204"
//    // Energized Power
    modImplementation "curse.maven:energized-power-782147:5650292"

    // create
    // modImplementation "net.createmod.ponder:Ponder-Fabric-${minecraft_version}:1.0.45"
//    modApi "dev.engine-room.flywheel:flywheel-fabric-api-${minecraft_version}:1.0.1-11"
    // modImplementation "dev.engine-room.flywheel:flywheel-fabric-${minecraft_version}:1.0.1-11"

}

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

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

    // include the fabric compat recipes that were excluded from the common:main sourceSet
    from(project(":common").sourceSets.fabric.resources)
}

shadowJar {
    configurations = [project.configurations.shadowBundle]
    archiveClassifier = 'dev-shadow'
}

remapJar {
    input.set shadowJar.archiveFile
}

tasks.remapJar {
    injectAccessWidener.set(true)
}

publishMods {
    file = remapJar.archiveFile
    changelog = file("../CHANGELOG.md").getText()
    type = ALPHA
    modLoaders.add("fabric")

    modrinth {
        accessToken = providers.environmentVariable("MODRINTH_API_KEY")
        projectId = "4sYI62kA"
        minecraftVersions.add("1.21.1")
        minecraftVersions.add("1.21")

        requires("owo-lib")
        requires("geckolib")
        requires("stitch")
        requires("fabric-api")
        requires("architectury-api")

        announcementTitle = "Fabric Version on Modrinth"
    }

    curseforge {
        accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
        projectId = "1030830"
        minecraftVersions.add("1.21.1")
        minecraftVersions.add("1.21")

        requires("owo-lib")
        requires("geckolib")
        requires("stitch")
        requires("fabric-api")
        requires("architectury-api")

        javaVersions.add(JavaVersion.VERSION_21)
        clientRequired = true
        serverRequired = true

        projectSlug = "oritech"
        announcementTitle = "Fabric Version on CurseForge"
    }
}