-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
162 lines (140 loc) · 4.43 KB
/
build.gradle.kts
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
import org.spongepowered.asm.gradle.plugins.MixinExtension
import org.spongepowered.asm.gradle.plugins.struct.DynamicProperties
import java.text.SimpleDateFormat
import java.util.*
buildscript {
repositories {
mavenCentral()
maven("https://maven.fabricmc.net/")
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0-Beta")
classpath("org.spongepowered:mixingradle:0.7.+")
}
}
apply(plugin = "kotlin")
apply(plugin = "org.spongepowered.mixin")
plugins {
eclipse
idea
`maven-publish`
id("net.minecraftforge.gradle") version "[6.0,6.2)"
id("org.jetbrains.kotlin.jvm") version "1.8.22"
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.22"
}
group = "com.pleahmacaka"
version = "1.20-0.1.0"
val modid = "examplemod"
val vendor = "pleahmacaka"
val minecraftVersion = "1.20.2"
val forgeVersion = "48.0.20"
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
println(
"Java: ${System.getProperty("java.version")} JVM: ${System.getProperty("java.vm.version")}(${
System.getProperty(
"java.vendor"
)
}) Arch: ${System.getProperty("os.arch")}"
)
minecraft {
mappings("official", minecraftVersion)
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
runs.all {
mods {
workingDirectory(project.file("run"))
property("forge.logging.markers", "REGISTRIES")
property("forge.logging.console.level", "debug")
property("forge.enabledGameTestNamespaces", modid)
property("terminal.jline", "true")
mods {
create(modid) {
source(sourceSets.main.get())
}
}
}
}
runs.run {
create("client") {
property("log4j.configurationFile", "log4j2.xml")
jvmArg("-XX:+AllowEnhancedClassRedefinition")
args("--username", "Player")
}
create("server") {}
create("gameTestServer") {}
create("data") {
workingDirectory(project.file("run"))
args(
"--mod",
modid,
"--all",
"--output",
file("src/generated/resources/"),
"--existing",
file("src/main/resources")
)
}
}
}
sourceSets.main.configure { resources.srcDirs("src/generated/resources/") }
repositories {
mavenCentral()
maven {
name = "Kotlin for Forge"
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
}
}
fun getProperty(name: String): String {
return project.findProperty(name)?.toString() ?: System.getProperty(name)
}
dependencies {
minecraft("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
implementation("thedarkcolour:kotlinforforge:4.3.0")
}
val Project.mixin: MixinExtension
get() = extensions.getByType()
mixin.run {
add(sourceSets.main.get(), "examplemod.mixins.refmap.json")
config("examplemod.mixins.json")
val debug = this.debug as DynamicProperties
debug.setProperty("verbose", true)
debug.setProperty("export", true)
setDebug(debug)
}
tasks.withType<Jar> {
archiveBaseName.set(modid)
manifest {
attributes(
mapOf(
"Specification-Title" to modid,
"Specification-Vendor" to vendor,
"Specification-Version" to "1",
"Implementation-Title" to project.name,
"Implementation-Version" to project.version.toString(),
"Implementation-Vendor" to vendor,
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
)
)
}
finalizedBy("reobfJar")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
repositories {
maven {
url = uri("file://${project.projectDir}/mcmodsrepo")
}
}
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
}
}