ViaForge/mc1122/build.gradle
2023-04-20 22:23:55 +02:00

151 lines
4.2 KiB
Groovy

buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2" }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:5.1.+"
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
classpath "com.github.johnrengelman:shadow:7.0.0"
}
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "org.spongepowered.mixin"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "java"
version = "1.12.2-${mod_version}"
group = "${mod_base_package}.${mod_id}"
archivesBaseName = mod_id
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
compileJava.options.encoding = "UTF-8"
minecraft {
mappings channel: "stable", version: "39-1.12"
runs {
client {
workingDirectory project.file("run")
property 'forge.logging.markers', 'REGISTRIES'
property "forge.logging.console.level", "debug"
// mixin
property 'mixin.debug.export', 'true'
property "mixin.hotSwap", "true"
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader"
if (project.hasProperty('mc_uuid'))
args '--uuid', project.getProperty('mc_uuid')
if (project.hasProperty('mc_username'))
args '--username', project.getProperty('mc_username')
if (project.hasProperty('mc_accessToken'))
args '--accessToken', project.getProperty('mc_accessToken')
args '-mixin.config=' + 'mixins.' + project.getProperty('mod_id') + '.json'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources {
srcDir "src/generated/resources"
}
repositories {
maven {
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://repo.viaversion.com"
}
maven {
url = "https://jitpack.io"
}
}
configurations {
include
implementation.extendsFrom(include)
}
def viaLibs = [
"com.viaversion:viaversion:${project.viaversion_version}",
"com.viaversion:viabackwards:${project.viabackwards_version}",
"com.viaversion:viarewind-core:${project.viarewind_version}",
"org.yaml:snakeyaml:${project.snake_yml_version}",
"com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
]
dependencies {
minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2859"
include "org.spongepowered:mixin:${mixin_version}"
for (final def via in viaLibs) {
implementation(via)
}
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
mixin {
add sourceSets.main, "mixins.${mod_id}.refmap.json"
}
jar {
manifest.attributes(
"Specification-Title": "viaforge",
"Specification-Vendor": "viaforge",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${archiveVersion}",
"Implementation-Vendor" :"viaforge",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": "0",
"FMLCorePluginContainsFMLMod": "true",
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader",
"MixinConfigs": "mixins.${mod_id}.json",
"ForceLoadAsMod": "true"
)
enabled = false
}
shadowJar {
archiveFileName = jar.archiveFileName
compileJava.options.encoding = "UTF-8"
exclude "native-binaries/*"
dependencies {
for (final def lib in viaLibs) {
include(dependency(lib))
}
include(dependency("org.spongepowered:mixin:${mixin_version}"))
}
}
reobf {
shadowJar {}
}
jar.dependsOn("shadowJar")