-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
169 lines (141 loc) · 4.19 KB
/
build.gradle
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
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'me.modmuss50.mod-publish-plugin' version '0.6.3'
}
version = project.mod_version
group = project.maven_group
base {
archivesName = project.mod_id
}
repositories {
// Add repositories to retrieve artifacts from in here.
}
fabricApi {
configureDataGeneration()
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
sourceSets.main.resources.exclude "src/main/generated/.cache/*"
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
processResources {
def properties = [
version : mod_version, github_repo: 'http://github.com/' + github,
display_name: display_name, modrinth_id: modrinth_id, curseforge_id: curseforge_id
]
inputs.properties properties
filesMatching("fabric.mod.json") {
expand properties
}
doLast {
filesMatching("**/*.json") {
def file = it.file
def parsed = new JsonSlurper().parse file
parsed.remove "credit"
file.text = JsonOutput.toJson parsed
}
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
java {
withSourcesJar()
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
}
jar {
from "LICENSE"
exclude "net/anawesomguy/carnivalfoods/data/**"
filesMatching("fabric.mod.json") {
def file = it.file
def parsed = new JsonSlurper().parse file
parsed.entrypoints.remove("fabric-datagen")
file.text = JsonOutput.toJson parsed
}
}
loom {
// splitEnvironmentSourceSets()
//
// mods {
// "${project.mod_id}" {
// sourceSet sourceSets.main
// sourceSet sourceSets.client
// }
// }
// accessWidenerPath = file("src/main/resources/${mod_id}.accesswidener")
mixin.useLegacyMixinAp = false
runs {
clientMixinDebug {
client()
ideConfigGenerated true
name = "Client Mixin Debug"
source sourceSets.main
property 'mixin.debug', 'true'
}
serverMixinDebug {
server()
ideConfigGenerated true
name = "Server Mixin Debug"
source sourceSets.main
property 'mixin.debug', 'true'
}
}
}
/*
static traverseAndRemoveUnnecessaryTop(Map<String, ?> obj, FileCopyDetails f) {
if (f.sourcePath.matches(/data\/[0-9a-zA-Z_-]\/recipes/))
if (obj?.result?.count == 1)
obj.result.remove "count"
traverseAndRemoveUnnecessary obj
}
static traverseAndRemoveUnnecessary(Map<String, ?> obj) {
obj.each {e -> {
def v = e.value
if (v instanceof Map<String, ?>)
traverseAndRemoveUnnecessary v
else if (v instanceof List<?>)
traverseAndRemoveUnnecessary v
else if (v instanceof String)
if (v.startsWith("minecraft:"))
e.value = v.substring 10
}}
}
static traverseAndRemoveUnnecessary(List<?> a) {
a.eachWithIndex {(v, i) -> {
if (v instanceof Map<String, ?>)
traverseAndRemoveUnnecessary v
else if (v instanceof List<?>)
traverseAndRemoveUnnecessary v
else if (v instanceof String)
if (v.startsWith("minecraft:"))
a[i] = v.substring(10)
}}
}
*/
publishMods {
file = remapJar.archiveFile
additionalFiles.from remapSourcesJar.archiveFile
type = STABLE
changelog = file("CHANGELOG.md").text
modLoaders.add 'fabric'
displayName = display_name + mod_version
modrinth {
projectId = modrinth_id
accessToken = providers.environmentVariable 'MODRINTH_TOKEN'
minecraftVersions.addAll minecraft_version, '1.21'
requires {
slug = 'fabric-api'
}
}
github {
accessToken = providers.environmentVariable 'GITHUB_TOKEN'
repository = github
tagName = mod_version
commitish = 'master'
}
}