1- buildscript {
2- repositories {
3- maven { url = ' https://files.minecraftforge.net/maven' }
4- maven { url = ' https://repo.spongepowered.org/maven' }
5- maven { url " https://plugins.gradle.org/m2/" }
6- mavenCentral()
7- }
8- dependencies {
9- classpath group : ' net.minecraftforge.gradle' , name : ' ForgeGradle' , version : ' 6.+' , changing : true
10- classpath group : ' org.spongepowered' , name : ' mixingradle' , version : ' 0.7-SNAPSHOT'
11- classpath " gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
12- classpath group : ' com.modrinth.minotaur' , name : ' Minotaur' , version : ' 2+'
13- }
1+ plugins {
2+ id ' java-library'
3+ id ' eclipse'
4+ id ' idea'
5+ id ' maven-publish'
6+ id ' net.neoforged.gradle.userdev' version ' 7.0.142'
7+ id ' net.darkhax.curseforgegradle' version ' 1.1.15'
8+ id " com.modrinth.minotaur" version " 2.+"
149}
1510
16- apply plugin : ' net.minecraftforge.gradle'
17- apply plugin : ' org.spongepowered.mixin'
18- apply plugin : " com.matthewprenger.cursegradle"
19- apply plugin : ' maven-publish'
20- apply plugin : ' com.modrinth.minotaur'
21-
22- version = " 1.20.1-1.0"
2311def env = System . getenv()
2412if (env. GITHUB_RUN_NUMBER ) {
25- version = version + " +" + " ${ env.GITHUB_RUN_NUMBER} "
13+ mod_version = ' neoforge-1.20.4-1.0.0 ' + " +" + " ${ env.GITHUB_RUN_NUMBER} "
2614}
2715
28- group = ' uk.co.hexeption'
29- archivesBaseName = ' RSInfinityBooster'
30-
31- java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
32- println (' Java: ' + System . getProperty(' java.version' ) + ' JVM: ' + System . getProperty(' java.vm.version' ) + ' (' + System . getProperty(' java.vendor' ) + ' ) Arch: ' + System . getProperty(' os.arch' ))
33-
34- minecraft {
35- mappings channel : ' official' , version : ' 1.20.1'
36-
37- runs {
38- client {
39- workingDirectory project. file(' run/client' )
40- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
41- property ' forge.logging.console.level' , ' debug'
42- arg " -mixin.config=rsinfinitybooster.mixins.json"
43-
44- mods {
45- rsinfinitybooster {
46- source sourceSets. main
47- }
48- }
49- }
50-
51- server {
52- workingDirectory project. file(' run/server' )
53- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
54- property ' forge.logging.console.level' , ' debug'
55- arg " -mixin.config=rsinfinitybooster.mixins.json"
56-
57- mods {
58- rsinfinitybooster {
59- source sourceSets. main
60- }
61- }
62- }
63-
64- data {
65- workingDirectory project. file(' run/data' )
66- // property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
67- property ' forge.logging.console.level' , ' debug'
68- args ' --mod' , ' rsinfinitybooster' , ' --all' ,
69- ' --existing' , file(' src/main/resources' ). toString(),
70- ' --existing' , file(' src/generated/resources' ). toString(),
71- ' --output' , file(' src/generated/resources/' )
72-
73- mods {
74- rsinfinitybooster {
75- source sourceSets. main
76- }
77- }
78- }
79- }
80- }
81-
82- sourceSets. main. resources { srcDir ' src/generated/resources' }
16+ version = mod_version
17+ group = mod_group_id
8318
8419repositories {
20+ mavenLocal()
8521 maven {
8622 url = uri(" https://maven.pkg.github.com/refinedmods/refinedstorage" )
8723 /* As of december 2021, GitHub packages requires authentication.
@@ -115,111 +51,112 @@ repositories {
11551 }
11652}
11753
118- dependencies {
119- minecraft ' net.minecraftforge:forge:1.20.1-47.0.3'
120- annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
121- compileOnly " com.refinedmods:refinedstorage:1.12.3"
122- runtimeOnly fg. deobf(" com.refinedmods:refinedstorage:1.12.3" ) {
123- transitive false
124- }
125- runtimeOnly fg. deobf(" mezz.jei:jei-1.20.1-forge:15.0.0.12" )
54+ base {
55+ archivesName = mod_id
12656}
12757
58+ // Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
59+ java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
60+
61+ runs {
62+ configureEach {
63+ systemProperty ' forge.logging.markers' , ' REGISTRIES'
64+ systemProperty ' forge.logging.console.level' , ' debug'
65+
66+ modSource project. sourceSets. main
67+ }
68+
69+ client {
70+ systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
71+ }
72+
73+ server {
74+ systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
75+ programArgument ' --nogui'
76+ }
77+
78+ gameTestServer {
79+ systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
80+ }
12881
129- jar {
130- manifest {
131- attributes([
132- " Specification-Title" : " rsinfinitybooster" ,
133- // "Specification-Vendor": "rsinfinitybooster authors",
134- " Specification-Version" : " 1" , // We are version 1 of ourselves
135- " Implementation-Title" : project. name,
136- " Implementation-Version" : project. version,
137- // "Implementation-Vendor": "rsinfinitybooster authors",
138- " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" ),
139- " MixinConfigs" : " rsinfinitybooster.mixins.json"
140- ])
82+ data {
83+ programArguments. addAll ' --mod' , project. mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ). getAbsolutePath(), ' --existing' , file(' src/main/resources/' ). getAbsolutePath()
14184 }
14285}
14386
144- jar . finalizedBy( ' reobfJar ' )
87+ sourceSets . main . resources { srcDir ' src/generated/resources ' }
14588
146- mixin {
147- add sourceSets . main, " rsinfinitybooster.refmap.json "
89+ configurations {
90+ runtimeClasspath . extendsFrom localRuntime
14891}
14992
150- task sourcesJar (type : Jar , dependsOn : classes) {
151- archiveClassifier = ' sources'
152- from sourceSets. main. allSource
93+ dependencies {
94+ implementation " net.neoforged:neoforge:${ neo_version} "
95+ annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
96+ runtimeOnly " mezz.jei:jei-1.20.6-neoforge:18.0.0.62"
97+ compileOnly " com.refinedmods:refinedstorage:1.13.0-beta.4"
98+ runtimeOnly " com.refinedmods:refinedstorage:1.13.0-beta.4"
15399}
154100
155- task deobfJar (type : Jar ) {
156- from sourceSets. main. output
157- archiveClassifier = ' deobf'
101+ tasks. withType(ProcessResources ). configureEach {
102+ var replaceProperties = [
103+ minecraft_version : minecraft_version,
104+ minecraft_version_range : minecraft_version_range,
105+ neo_version : neo_version,
106+ neo_version_range : neo_version_range,
107+ loader_version_range : loader_version_range,
108+ mod_id : mod_id,
109+ mod_name : mod_name,
110+ mod_license : mod_license,
111+ mod_version : mod_version,
112+ mod_authors : mod_authors,
113+ mod_description : mod_description
114+ ]
115+ inputs. properties replaceProperties
116+
117+ filesMatching([' META-INF/mods.toml' ]) {
118+ expand replaceProperties
119+ }
158120}
159121
160- artifacts {
161- archives jar
162- archives sourcesJar
163- archives deobfJar
122+
123+ tasks. withType(JavaCompile ). configureEach {
124+ options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
164125}
165126
166- curseforge {
167- if (env. CURSE_API_KEY ) {
168- apiKey = env. CURSE_API_KEY
169- }
170- project {
171- id = ' 446870'
172- changelog = ' A changelog can be found at https://github.com/Hexeption/RSInfinityBooster'
173- releaseType = ' release'
174- addGameVersion ' 1.20.1'
175-
176- mainArtifact(jar) {
177- displayName = " RSInfinityBooster v$version "
178- }
179- relations {
180- requiredDependency ' refined-storage'
181- }
127+ // IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
128+ idea {
129+ module {
130+ downloadSources = true
131+ downloadJavadoc = true
182132 }
183133}
184134
185- // configure the maven publication
186- publishing {
187- publications {
188- mavenJava(MavenPublication ) {
189- artifact jar
190- artifact sourcesJar
191- artifact deobfJar
192- }
193- }
135+ task publishCurseForge (type : net.darkhax.curseforgegradle.TaskPublishCurseForge ) {
136+
137+ apiToken = env. CURSE_API_KEY
138+
139+ // The main file to upload
140+ def mainFile = upload(446870 , jar)
141+ mainFile. releaseType = ' release'
142+ mainFile. changelog = ' A changelog can be found at https://github.com/Hexeption/RSInfinityBooster'
143+ mainFile. changelogType = ' markdown'
144+ mainFile. gameVersions = [' 1.20.4' ]
145+ mainFile. addModLoader(" neoforge" )
146+ mainFile. displayName = " RSInfinityBooster ${ version} "
147+
194148
195- // select the repositories you want to publish to
196- repositories {
197- // uncomment to publish to the local maven
198- // mavenLocal()
199- if (env. REPO_PASSWORD ) {
200- maven {
201- url = " https://nexus.hexeption.dev/repository/hex-mods/"
202- credentials {
203- username = " admin"
204- password = env. REPO_PASSWORD
205- }
206- }
207- }
208- }
209149}
210150
211151modrinth {
212- if (env. MODRINTH_API_KEY ) {
213- token = env. MODRINTH_API_KEY
214- }
152+ token = env. MODRINTH_API_KEY
215153 projectId = ' Sjzdj2cy'
216- versionName = " RSInfinityBooster v $version "
154+ versionName = " RSInfinityBooster $version "
217155 changelog = ' A changelog can be found at https://github.com/Hexeption/RSInfinityBooster'
218- versionNumber = " $version "
219156 uploadFile = jar
220- gameVersions = [" 1.20.1 " ]
221- loaders = [" forge " ]
157+ gameVersions = [" 1.20.4 " ]
158+ loaders = [" neoforge " ]
222159 dependencies {
223- required. version " refined-storage" , " 1.12.3 "
160+ required. version " refined-storage" , " 1.13.0-beta.4 "
224161 }
225- }
162+ }
0 commit comments