forked from MCModderAnchor/TACZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
236 lines (211 loc) · 8.21 KB
/
build.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
import java.text.SimpleDateFormat
// 设置日期格式,用于填充快照版版本号
SimpleDateFormat FORMAT = new SimpleDateFormat("MMdd-HHmmss")
FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"))
buildscript {
repositories {
maven { url = "https://plugins.gradle.org/m2/" }
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://maven.parchmentmc.org' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
maven {
// 阿里云镜像,方便国内开发
url = uri("https://maven.aliyun.com/repository/public/")
}
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.parchmentmc:librarian:1.+'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'eclipse'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'java'
//version = "1.0.4"
// 版本号,正式发布需要修改这一行
version = FORMAT.format(new Date())
group = "com.tacz"
archivesBaseName = "tacz-1.20.1"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
mixin {
add sourceSets.main, "tacz.refmap.json"
config "tacz.mixins.json"
}
minecraft {
// 使用 parchment 来反混淆变量名
mappings channel: 'parchment', version: '2023.08.20-1.20.1'
// 使用 access transformer 来修改原版的一些方法访问修饰符
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// 运行参数
runs {
client {
// 使用 JetBrainsRuntime 时需要的参数,否则无法热重载
// 如果你使用别的 JDK,那么可以删除这一行
jvmArgs "-XX:+AllowEnhancedClassRedefinition"
// 每个启动单独区分文件夹
workingDirectory project.file('run/client_a')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
mods {
tacz {
source sourceSets.main
}
}
}
client2 {
parent minecraft.runs.client
workingDirectory project.file('run/client_b')
// 设定用户名
args '--username', 'mayday_memory'
mods {
tacz {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run/server')
property 'mixin.env.disableRefMap', 'true'
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
tacz {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run/data')
property 'mixin.env.disableRefMap', 'true'
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'tacz', '--all', '--output', file('src/generated/resources/')
mods {
tacz {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven {
// 阿里云镜像,方便国内开发
url = uri("https://maven.aliyun.com/repository/public/")
content {
includeGroup 'org.apache.commons'
}
}
maven {
// location of the maven that hosts JEI files since January 2023
// Patchouli
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "Mod Maven"
url = "https://modmaven.k-4u.nl"
}
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven { url "https://maven.shedaniel.me/" } // cloth config api
maven { url "https://dvs1.progwml6.com/files/maven/" }
maven { url "https://modmaven.dev" }
maven {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven {
url 'https://jitpack.io'
}
maven {
name "KosmX's maven"
url 'https://maven.kosmx.dev/'
}
mavenCentral() // MixinExtras is there
mavenLocal()
flatDir {
dir 'libs'
}
}
dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"
// Apache Commons Math 库,用于进行一些插值运算
minecraftLibrary(jarJar('org.apache.commons:commons-math3:3.6.1')) {
jarJar.ranged(it, "[3.6.1,)")
}
// LuaJ 库,将 lua 脚本语言引入用于控制枪械的逻辑和动画状态机
minecraftLibrary(jarJar('com.github.FiguraMC.luaj:luaj-core:3.0.8-figura')) {
exclude group: 'org.apache.commons', module: 'commons-lang3'
jarJar.ranged(it, "[3.0.8,)")
}
minecraftLibrary(jarJar('com.github.FiguraMC.luaj:luaj-jse:3.0.8-figura')) {
exclude group: 'org.apache.commons', module: 'commons-lang3'
jarJar.ranged(it, "[3.0.8,)")
}
minecraftLibrary(jarJar('org.apache.bcel:bcel:6.6.1')) {
exclude group: 'org.apache.commons', module: 'commons-lang3'
jarJar.ranged(it, "[6.6.1,)")
}
// compile against the JEI API but do not include it at runtime
compileOnly(fg.deobf("mezz.jei:jei-1.20.1-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-1.20.1-forge-api:${jei_version}"))
// at runtime, use the full JEI jar for Forge
runtimeOnly(fg.deobf("mezz.jei:jei-1.20.1-forge:15.20.0.104"))
// 性能分析工具模组
runtimeOnly fg.deobf("curse.maven:spark-361579:4738952")
// 假人,测试近战伤害
runtimeOnly fg.deobf("curse.maven:selene-499980:5478857")
runtimeOnly fg.deobf("curse.maven:mmmmmmmmmmmm-225738:5319203")
// 手柄按键支持
implementation fg.deobf("curse.maven:framework-549225:4718251")
compileOnly(fg.deobf("curse.maven:controllable-317269:4598985"))
// 越肩视角,用来兼容第三人称准星
implementation fg.deobf("curse.maven:shoulder-surfing-reloaded-243190:5455954")
implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_forge}")
compileOnly fg.deobf("curse.maven:embeddium-908741:${embeddedt_id}")
// 同时兼容两个版本
compileOnly fg.deobf('libs:oculus_legacy:mc1.20.1-1.6.13')
compileOnly fg.deobf('libs:oculus:mc1.20.1-1.7.0')
runtimeOnly fg.deobf("curse.maven:carry-on-274259:${carry_on_id}")
implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${player_animation_lib}")
// 引入 MixinExtras 以解决一些棘手的 Mixin 冲突问题(比如 @Redirect 不能嵌套)
// 如果未来有迁移到 Fabric / NeoForge 的计划,请注意这两个框架都已自带 MixinExtras,无需自行打包。
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.6"))
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.3.6")) {
jarJar.ranged(it, "[0.3.6,)")
}
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
jar {
// 打包时,给 manifest 文件写入一些有用信息
// 这些信息会被游戏调用,从而显示成模组的名称和版本信息
manifest {
attributes([
"Implementation-Title" : project.name,
"Implementation-Version": project.version
])
}
}
java {
// 编译源码文件,方便发布 maven
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}