-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
164 lines (137 loc) · 5.2 KB
/
build.gradle.kts
File metadata and controls
164 lines (137 loc) · 5.2 KB
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
import org.gradle.kotlin.dsl.withType
plugins {
java
idea
id("net.neoforged.moddev") version "2.0.115"
}
version = project.property("mod_version") as String
group = project.property("mod_group_id") as String
base {
archivesName = project.property("mod_id") as String
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
neoForge {
// Specify the version of NeoForge to use.
version = project.property("neo_version") as String
parchment {
mappingsVersion = project.property("parchment_mappings_version") as String
minecraftVersion = project.property("parchment_minecraft_version") as String
}
// This line is optional. Access Transformers are automatically detected
// accessTransformers.add("src/main/resources/META-INF/accesstransformer.cfg")
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
create("client") {
client()
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty("neoforge.enabledGameTestNamespaces", project.property("mod_id") as String)
}
create("server") {
server()
programArgument("--nogui")
systemProperty("neoforge.enabledGameTestNamespaces", project.property("mod_id") as String)
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
create("gameTestServer") {
type = "gameTestServer"
systemProperty("neoforge.enabledGameTestNamespaces", project.property("mod_id") as String)
}
create("dev") {
client()
devLogin = true
}
create("data") {
data()
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// gameDirectory = project.file("run-data")
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll(
"--mod", project.property("mod_id") as String,
"--all",
"--output", file("src/generated/resources/").getAbsolutePath(),
"--existing", file("src/main/resources/").getAbsolutePath()
)
}
// applies to all the run configs above
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty("forge.logging.markers", "REGISTRIES")
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// mostly optional in a single mod project
// but multi mod projects should define one per mod
create(project.property("mod_id") as String) {
sourceSet(sourceSets.main.get())
}
}
}
repositories {
mavenLocal()
exclusiveContent {
forRepository {
maven {
name = "GeckoLib"
setUrl("https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/")
}
}
filter {
includeGroup("software.bernie.geckolib")
}
}
}
dependencies {
compileOnly("org.projectlombok:lombok:1.18.42")
annotationProcessor("org.projectlombok:lombok:1.18.42")
implementation("software.bernie.geckolib:geckolib-neoforge-${project.property("minecraft_version")}:${project.property("geckolib_version")}")
}
tasks.withType(JavaExec::class) {
if (javaLauncher.get().metadata.vendor == "JetBrains") {
jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods")
}
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
var generateModMetadata = tasks.register<ProcessResources>("generateModMetadata") {
val replaceProperties = mapOf(
"minecraft_version" to project.property("minecraft_version"),
"minecraft_version_range" to project.property("minecraft_version_range"),
"neo_version" to project.property("neo_version"),
"neo_version_range" to project.property("neo_version_range"),
"loader_version_range" to project.property("loader_version_range"),
"mod_id" to project.property("mod_id"),
"mod_name" to project.property("mod_name"),
"mod_license" to project.property("mod_license"),
"mod_version" to project.property("mod_version"),
"mod_authors" to project.property("mod_authors"),
"mod_description" to project.property("mod_description")
)
inputs.properties(replaceProperties)
expand(replaceProperties)
from("src/main/templates")
into("build/generated/sources/modMetadata")
}
sourceSets.main.configure {
resources.srcDir("src/generated/resources")
resources.srcDir(generateModMetadata)
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}