-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
220 lines (182 loc) · 6.4 KB
/
build.gradle
File metadata and controls
220 lines (182 loc) · 6.4 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
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
plugins {
id 'net.minecraftforge.gradle' version '6.+'
id 'idea'
id "maven-publish"
id "org.parchmentmc.librarian.forgegradle" version "1.+"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.9"
id('com.modrinth.minotaur') version '2.+'
id('com.matthewprenger.cursegradle') version '1.4.0'
}
group = "noodlepfp.mobees"
version = mobeesVersion
base.archivesName = "mobees-$minecraftVersion"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'parchment', version: "$mappingsVersion-$minecraftVersion"
runs {
configureEach {
workingDirectory project.file("run")
property "forge.logging.console.level", "debug"
property "fml.earlyprogresswindow", "false"
// See https://github.com/Vazkii/Patchouli#mixin-troubleshooting
property "mixin.env.remapRefMap", "true"
property "mixin.env.refMapRemappingFile", "$projectDir/build/createSrgToMcp/output.srg"
mods {
forestry {
source sourceSets.main
}
}
}
client {}
server {
workingDirectory project.file("run/server")
}
data {
args "--mod", "mobees", "--all", "--output", file("src/generated/resources/"), "--existing", file("src/main/resources/")
}
}
}
repositories {
maven {
name = 'jei'
url = 'https://maven.blamejared.com/'
content { includeGroup "mezz.jei" }
}
maven {
name = "Patchouli"
url = "https://maven.blamejared.com/"
}
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = 'ModKit'
url 'https://jitpack.io'
content { includeGroup 'com.github.thedarkcolour' }
}
maven {
name 'DVS1 Maven FS'
url 'https://dvs1.progwml6.com/files/maven'
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
forRepositories(fg.repository) // Only add this if you're using ForgeGradle, otherwise remove this line
filter {
includeGroup "maven.modrinth"
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
// JEI OPTIONAL
compileOnly fg.deobf("mezz.jei:jei-$minecraftVersion-common-api:$jeiVersion")
compileOnly fg.deobf("mezz.jei:jei-$minecraftVersion-forge-api:$jeiVersion")
runtimeOnly fg.deobf("mezz.jei:jei-$minecraftVersion-forge:$jeiVersion")
// PATCHOULI REQUIRED
compileOnly fg.deobf("vazkii.patchouli:Patchouli:$patchouliVersion-FORGE:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:$patchouliVersion-FORGE")
implementation fg.deobf("maven.modrinth:forestry-community-edition:$forestryVersion")
// implementation fg.deobf("maven.modrinth:cofh-core:11.0.2")
// implementation fg.deobf("maven.modrinth:thermal-foundation:11.0.6")
// implementation fg.deobf("maven.modrinth:thermal-dynamics:11.0.1")
// implementation fg.deobf("slimeknights.mantle:Mantle:1.20.1-1.11.50")
// implementation fg.deobf("slimeknights.tconstruct:TConstruct:1.20.1-3.9.1.19")
// implementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:1.20.1-10.1.0-171.2")
// ModKit DEV ONLY
implementation fg.deobf('com.github.thedarkcolour:ModKit:0302f9aa42')
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
"version" : project.version,
"forgeVersionRange" : forgeVersionRange,
"jeiVersionRange" : jeiVersionRange,
"patchouliVersionRange": patchouliVersionRange,
"fmlVersionRange" : fmlVersionRange,
"forestryVersionRange" : forestryVersionRange,
]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
sourceSets.main.resources.srcDir generateModMetadata
idea.project.settings {
taskTriggers {
afterSync generateModMetadata
}
}
jar {
finalizedBy "reobfJar"
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
if (System.getenv("CURSEFORGE_TOKEN")) {
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN")
project {
id = project.curseforgeId
changelogType = "markdown"
changelog = getChangelog(version)
releaseType = "release"
addGameVersion(project.minecraftVersion)
addGameVersion("Forge")
addGameVersion("Java 17")
mainArtifact(jar.archiveFile) {
displayName = "MoBees ${project.version}"
relations {
requiredDependency 'forestry-community-edition'
}
}
}
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = project.modrinthId
versionName = "MoBees $version"
versionNumber = version.toString()
versionType = "release"
gameVersions = [minecraftVersion]
loaders = ["forge"]
changelog = getChangelog(project.version)
uploadFile = jar
dependencies {
required.project("forestry-community-edition")
}
}
static def getChangelog(Object version) {
version = version.toString()
def file = new File('changelog.md')
if (!file.exists()) {
return "Changelog file not found"
}
// Relies on the changelog block being "##blahblahblah_VERSION" where _ is a space
def content = file.text.normalize().split("##.* ")
for (final def chunk in content) {
if (chunk.isEmpty()) continue
def lineTerminatorIndex = chunk.findIndexOf { c -> c == '\n' || c == '\r' }
def versionString = chunk.substring(0, lineTerminatorIndex)
if (versionString == version) {
return "## MoBees $version\n" + chunk.substring(lineTerminatorIndex + 1)
}
}
// Fallback in case this fails
return "MoBees Update ${version}"
}