generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 62
/
common.gradle
113 lines (98 loc) · 3.24 KB
/
common.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
apply(plugin: "maven-publish")
apply(plugin: "fabric-loom")
apply(plugin: "io.github.juuxel.loom-quiltflower")
apply(plugin: "com.replaymod.preprocess")
int mcVersion = 1
preprocess {
mcVersion = vars.get()["MC"]
tabIndentation = false
}
repositories {
maven {
url 'https://www.cursemaven.com/'
}
maven {
url = "https://api.modrinth.com/maven"
}
maven {
url 'https://maven.hendrixshen.top'
}
mavenCentral()
mavenLocal()
}
dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings(loom.officialMojangMappings())
modImplementation("top.hendrixshen:magiclib-${project.minecraft_version.replace(".", "_")}:${project.magiclib_version}") {
if (project.name == "snapshot") {
exclude group: 'curse.maven', module: 'in-game-account-switcher-232676'
}
}
runtimeOnly(project(path: ":fabricWrapper"))
}
loom {
// mixin {
// // 如果使用 Legacy Mixin Ap,有时候 Mixin class remap 会有问题,该 remap 的不 remap
// useLegacyMixinAp = false
// }
runConfigs.all {
// to make sure it generates all "Minecraft Client (:subproject_name)" applications
// ideConfigGenerated = true
property("mixin.debug.export", "true")
runDir "../../run"
}
}
remapJar {
remapperIsolation = true
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name + "-" + project.minecraft_version
version = project.parent.version
group = project.maven_group
processResources {
inputs.property("version", version)
filesMatching("fabric.mod.json") {
expand(["mod_version" : project.version,
"mod_id" : project.mod_id,
"mod_name" : project.mod_name,
"mod_homepage" : project.mod_homepage,
"mod_sources" : project.mod_sources,
"mod_license" : project.mod_license,
"minecraft_dependency": project.minecraft_dependency,
"minecraft_version_id": project.minecraft_version.replace(".", "_"),
"minecraft_version" : project.minecraft_version,
"magiclib_version" : project.magiclib_version
])
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("../../LICENSE")
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = "${project.mod_id}-${project.minecraft_version.replace(".", "_")}"
version = project.version
from(components.java)
}
}
repositories {
mavenLocal()
maven {
url("$rootDir/publish")
}
}
}