Files
TACZ/build.gradle

266 lines
9.3 KiB
Groovy
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.1.7-hotfix"
// 版本号,正式发布需要修改这一行
//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"
config "tacz.compat.acceleratedrendering.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 {
// Shedaniel's maven (Architectury API)
url = "https://maven.architectury.dev"
content {
includeGroup "dev.architectury"
}
}
maven {
// latvian.dev Maven (KubeJS and Rhino)
url "https://maven.latvian.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}
maven {
url 'https://jitpack.io'
content {
includeGroup "com.github.rtyley"
includeGroup "com.github.FiguraMC.luaj"
}
}
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}")
// kubejs开发环境引入
compileOnly fg.deobf("dev.latvian.mods:kubejs-forge:${kubejs_version}")
compileOnly fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
compileOnly fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
//加速渲染相关
compileOnly fg.deobf("curse.maven:accelerated-rendering-1314021:7342975")
// 引入 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,
"MixinConfigs": "tacz.mixins.json, tacz.compat.acceleratedrendering.mixins.json"
])
}
}
java {
// 编译源码文件,方便发布 maven
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}