Wither Config allows you to adjust the Wither's stats and behavior for a tailored boss experience.
1import org.gradle.kotlin.dsl.buildConfigField
2import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
3import org.jetbrains.gradle.ext.runConfigurations
4import org.jetbrains.gradle.ext.settings
5import kotlin.text.replace
6
7plugins {
8 id("org.jetbrains.gradle.plugin.idea-ext") version "1.3"
9 id("com.gtnewhorizons.retrofuturagradle") version "2.0.2"
10 id("com.github.gmazzo.buildconfig") version "6.0.7"
11 id("io.freefair.lombok") version "9.1.0"
12}
13
14group = "dev.redstudio"
15version = "1.2.1" // This project adheres to [Ragnarök Versioning](https://github.com/Red-Studio-Ragnarok/Commons/blob/main/Ragnar%C3%B6k%20Versioning%20Convention.md)
16
17val id = project.name.lowercase().filter { !it.isWhitespace() }
18val plugin = "${project.group}.$id.asm.${project.name.filter { !it.isWhitespace() }}Plugin"
19
20val jvmCommonArgs = "-Dfile.encoding=UTF-8 -XX:+UseStringDeduplication"
21
22val mixinBooterVersion = "10.7"
23
24minecraft {
25 mcVersion = "1.12.2"
26 username = "Desoroxxx"
27 extraRunJvmArguments = listOf("-Dforge.logging.console.level=debug", "-Dfml.coreMods.load=$plugin", "-Dmixin.checks.mixininterfaces=true", "-Dmixin.debug.export=true") + jvmCommonArgs.split(" ")
28}
29
30repositories {
31 maven {
32 name = "Cleanroom"
33 url = uri("https://maven.cleanroommc.com")
34 content {
35 includeGroup("zone.rong")
36 }
37 }
38
39 mavenCentral()
40 mavenLocal()
41}
42
43dependencies {
44 annotationProcessor("org.ow2.asm:asm-debug-all:5.2")
45 annotationProcessor("com.google.guava:guava:32.1.2-jre")
46 annotationProcessor("com.google.code.gson:gson:2.8.9")
47
48 val mixinBooter: String = modUtils.enableMixins("zone.rong:mixinbooter:$mixinBooterVersion", "mixins.$id.refmap.json") as String
49 api(mixinBooter) {
50 isTransitive = false
51 }
52 annotationProcessor(mixinBooter) {
53 isTransitive = false
54 }
55}
56
57buildConfig {
58 packageName("${project.group}.${id}")
59 className("ProjectConstants")
60 documentation.set("This class defines constants for ${project.name}.\n<p>\nThey are automatically updated by Gradle.")
61 useJavaOutput()
62
63 // Details
64 buildConfigField("ID", id)
65 buildConfigField("NAME", project.name)
66 buildConfigField("VERSION", project.version.toString())
67
68 // Versions
69 buildConfigField("MIXIN_BOOTER_VERSION", mixinBooterVersion)
70
71 // Loggers
72 buildConfigField("org.apache.logging.log4j.Logger", "LOGGER", "org.apache.logging.log4j.LogManager.getLogger(NAME)")
73}
74
75// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
76java {
77 toolchain {
78 languageVersion.set(JavaLanguageVersion.of(8))
79 vendor.set(JvmVendorSpec.ADOPTIUM)
80 }
81 if (!project.version.toString().contains("Dev"))
82 withSourcesJar() // Generate sources jar, for releases
83}
84
85tasks {
86 processResources {
87 val expandProperties = mapOf(
88 "version" to project.version,
89 "name" to project.name,
90 "id" to id
91 )
92
93 inputs.properties(expandProperties)
94
95 filesMatching("**/*.*") {
96 val exclusions = arrayOf(".png")
97 if (!exclusions.any { path.endsWith(it) })
98 expand(expandProperties)
99 }
100 }
101
102 val processReadme by registering {
103 val input = rootProject.file("README.md")
104 val output = layout.buildDirectory.file("processed-readme/README.md")
105
106 inputs.file(input)
107 outputs.file(output)
108
109 doLast {
110 val content = input.readText()
111 val firstHash = content.indexOf('#')
112 val lastSeparator = content.lastIndexOf("---")
113
114 val trimmed = when {
115 firstHash != -1 && lastSeparator > firstHash -> content.substring(firstHash, lastSeparator)
116 firstHash != -1 -> content.substring(firstHash)
117 else -> content
118 }
119
120 output.get().asFile.parentFile.mkdirs()
121 output.get().asFile.writeText(trimmed.trim())
122 }
123 }
124
125 withType<Jar> {
126 dependsOn(processReadme)
127 from(processReadme.map { it.outputs.files })
128 from(rootProject.file("LICENSE"))
129 from(rootProject.file("CHANGELOG.md"))
130
131 manifest {
132 attributes(
133 "ModSide" to "BOTH",
134 "FMLCorePlugin" to plugin,
135 "FMLCorePluginContainsFMLMod" to "true",
136 "ForceLoadAsMod" to "true"
137 )
138 }
139 }
140
141 withType<JavaCompile>{
142 options.encoding = "UTF-8"
143
144 options.isFork = true
145 options.forkOptions.jvmArgs = jvmCommonArgs.split(" ")
146 }
147}
148
149idea {
150 module {
151 inheritOutputDirs = true
152 excludeDirs.addAll(setOf(".gradle", ".idea", "build", "gradle", "run", "gradlew", "gradlew.bat", "desktop.ini").map(::file))
153 }
154
155 project {
156 settings {
157 jdkName = "1.8"
158 languageLevel = IdeaLanguageLevel("JDK_1_8")
159
160
161 runConfigurations {
162 listOf("Client", "Server", "Obfuscated Client", "Obfuscated Server", "Vanilla Client", "Vanilla Server").forEach { name ->
163 create(name, org.jetbrains.gradle.ext.Gradle::class.java) {
164 val prefix = name.substringBefore(" ").let { if (it == "Obfuscated") "Obf" else it }
165 val suffix = name.substringAfter(" ").takeIf { it != prefix } ?: ""
166 taskNames = setOf("run$prefix$suffix")
167
168 jvmArgs = jvmCommonArgs
169 }
170 }
171 }
172 }
173 }
174}