archivesBaseName = "${mod_name.replace(" ", "")}-Common-${minecraft_version}"

dependencies {
    stupidRemapArch("dev.ftb.mods:ftb-essentials:${ftb_essentials}")
}

shadowJar {
    from sourceSets.main.output
    configurations = [project.configurations.shade]

    dependencies {
        exclude(dependency('com.google.code.gson:.*'))

        relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
        relocate 'me.hypherionmc.mcdiscordformatter', 'shadow.hypherionmc.mcdiscordformatter'
        relocate 'net.kyori', 'shadow.kyori'
    }
    setArchiveClassifier("dev")
}

/**
 * ===============================================================================
 * =       DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING        =
 * ===============================================================================
 */

unimined.minecraft {
    fabric {
        loader fabric_loader
    }

    defaultRemapJar = false
}

processResources {
    def buildProps = project.properties.clone()

    filesMatching(['pack.mcmeta']) {
        expand buildProps
    }
}

/**
 * Publishing Config
 */
publishing {
    publications {
        mavenCommon(MavenPublication) {
            artifactId project.archivesBaseName
            from components.java

            pom.withXml {
                Node pomNode = asNode()
                pomNode.dependencies.'*'.findAll() {
                    it.artifactId.text() == 'regutils-joined-fabric' ||
                            it.artifactId.text() == 'core' ||
                            it.artifactId.text() == 'toml'
                }.each() {
                    it.parent().remove(it)
                }
            }
        }
    }

    repositories {
        maven rootProject.orion.getPublishingMaven()
    }
}