mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-27 02:49:15 +00:00
90 lines
2.4 KiB
Groovy
90 lines
2.4 KiB
Groovy
plugins {
|
|
id 'fabric-loom' version '1.10-SNAPSHOT'
|
|
id 'com.gradleup.shadow' version '9.0.0-beta11'
|
|
}
|
|
|
|
version = project.project_version
|
|
group = project.project_group
|
|
|
|
base {
|
|
archivesName = "craft-engine-fabric-mod"
|
|
}
|
|
|
|
sourceSets {
|
|
client {
|
|
compileClasspath += main.compileClasspath
|
|
runtimeClasspath += main.runtimeClasspath
|
|
}
|
|
main {
|
|
output.dir(client.output)
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
relocate('org.yaml', 'net.momirealms.craftengine.libraries.org.yaml')
|
|
configurations = [project.configurations.shadow]
|
|
archiveFileName = "${base.archivesName.get()}-${project.version}-shadow.jar"
|
|
from sourceSets.main.output
|
|
from sourceSets.client.output
|
|
}
|
|
|
|
remapJar {
|
|
dependsOn shadowJar
|
|
inputFile = shadowJar.archiveFile
|
|
|
|
destinationDirectory = file("$rootDir/target")
|
|
archiveFileName = "${base.archivesName.get()}-${project.version}.jar"
|
|
}
|
|
|
|
loom {
|
|
mods {
|
|
"craft-engine-fabric-mod" {
|
|
sourceSet sourceSets.main
|
|
sourceSet sourceSets.client
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
shadow
|
|
implementation.extendsFrom(shadow)
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.latest_minecraft_version}"
|
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
|
shadow 'org.yaml:snakeyaml:2.4'
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", project.version
|
|
inputs.property "minecraft_version", project.latest_minecraft_version
|
|
inputs.property "loader_version", project.loader_version
|
|
filteringCharset "UTF-8"
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand "version": project.version,
|
|
"minecraft_version": project.latest_minecraft_version,
|
|
"loader_version": project.loader_version
|
|
}
|
|
}
|
|
|
|
def targetJavaVersion = 21
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.encoding = "UTF-8"
|
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
|
it.options.release.set(targetJavaVersion)
|
|
}
|
|
}
|
|
|
|
java {
|
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
|
if (JavaVersion.current() < javaVersion) {
|
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
|
}
|
|
withSourcesJar()
|
|
}
|
|
|
|
tasks.build.dependsOn |