-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.gradle
154 lines (142 loc) · 5.23 KB
/
common.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
apply plugin: 'maven-publish'
apply plugin: 'dev.architectury.loom'
apply plugin: 'com.replaymod.preprocess'
apply plugin: 'me.fallenbreath.yamlang'
apply plugin: 'com.modrinth.minotaur'
def mod_brand = (loom.platform.get() as String).toLowerCase()
assert mod_brand in ['fabric', 'forge', 'neoforge']
archivesBaseName = rootProject.archives_base_name + "-" + mod_brand
group = rootProject.maven_group
int mcVersion = 1
preprocess {
mcVersion = vars.get()["MC"] as int
tabIndentation = true
vars.put("MC", mcVersion)
vars.put("FABRIC", mod_brand == 'fabric' ? 1 : 0)
vars.put("NEOFORGE", mod_brand == 'neoforge' ? 1 : 0)
}
repositories {
mavenCentral()
mavenLocal()
maven { url = 'https://jitpack.io' }
maven { url = "https://maven.terraformersmc.com/releases" } // MODMENU
maven { url = "https://maven.neoforged.net/releases/" } // NEOFORGE
maven { url = "https://repo.kelcuprum.ru/forks" } // STARSCRIPT
maven { url = "https://maven.parchmentmc.org" } // MAPPINGS
}
configurations {
modRuntimeOnly.exclude group: 'net.fabricmc', module: 'fabric-loader'
}
loom {
runConfigs.client {
// to make sure it generates all "Minecraft Client (:subproject_name)" applications
ideConfigGenerated = true
runDir '../../run'
vmArgs '-Dmixin.debug.export=true'
}
accessWidenerPath = file("../../src/main/resources/alinlib.accesswidener")
}
remapJar {
if(mod_brand == 'neoforge') atAccessWideners.add("alinlib.accesswidener")
// remapperIsolation = true
injectAccessWidener = true
}
dependencies {
// loom
implementation("com.google.code.gson:gson:2.10.1")
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
}
include(implementation("meteordevelopment:starscript:0.3.4"))
if (mod_brand == 'fabric') {
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
} else if (mod_brand == 'neoforge') {
neoForge "net.neoforged:neoforge:${project.forge_version}"
}
}
int JAVA_COMPATIBILITY
if (mcVersion >= 12005)
JAVA_COMPATIBILITY = 21
else
JAVA_COMPATIBILITY = 17
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = JAVA_COMPATIBILITY
}
version = project.mod_version + "+mc" + project.minecraft_version
publishing {
repositories {
maven {
name = "Kel_Cuprum_Repository"
url = "https://repo.kelcuprum.ru/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
publications {
if(mod_brand == "neoforge"){
mavenNeoForge(MavenPublication) {
groupId rootProject.maven_group
version project.version
artifactId = rootProject.archives_base_name + "-neoforge"
from components.java
}
} else if(mod_brand == "fabric"){
mavenForge(MavenPublication) {
groupId rootProject.maven_group
version project.version
artifactId = rootProject.archives_base_name + "-fabric"
from components.java
}
}
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN") // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
versionName = project.modrinth_title + " " + rootProject.mod_version
projectId = "alinlib" // This can be the project ID or the slug. Either will work!
// You don't need to set this manually. Will fail if Modrinth has this version already
changelog = file("../../changelog.md").text
versionNumber = rootProject.mod_version
versionType = rootProject.version_type // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
project.modrinth_versions.split(", ").each {
gameVersions.add it
}
if(mod_brand == "fabric") loaders = ["fabric", "quilt"]
else loaders = [mod_brand]
dependencies {
if(mod_brand == "fabric"){
required.project "fabric-api"
optional.project "modmenu"
}
}
}
processResources {
inputs.property "version", version
inputs.property "minecraft_dependency", project.minecraft_dependency
[
'fabric': ['fabric.mod.json'],
'neoforge': ['META-INF/neoforge.mods.toml'],
'forge': ['META-INF/mods.toml', 'pack.mcmeta'],
].forEach { brand, files ->
files.forEach { name ->
if (brand == mod_brand) {
filesMatching(name) {
def valueMap = [
"version": version,
"minecraft_dependency": project.minecraft_dependency,
]
expand valueMap
}
} else {
exclude name
}
}
}
}