Skip to content

Commit 95623a6

Browse files
committed
Switch from specifying UUID to having optional support for DevLogin
1 parent 24d58a3 commit 95623a6

File tree

1 file changed

+10
-30
lines changed

1 file changed

+10
-30
lines changed

build.gradle

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import mekanism.MergeModuleResources
88
import mekanism.OptimizePng
99
import net.darkhax.curseforgegradle.TaskPublishCurseForge
1010
import net.darkhax.curseforgegradle.UploadArtifact
11-
import net.neoforged.gradle.dsl.common.runs.run.Run
1211

1312
import java.util.function.Consumer
1413

@@ -20,7 +19,7 @@ plugins {
2019
id('eclipse')
2120
id('idea')
2221
id('maven-publish')
23-
id('net.neoforged.gradle.userdev') version('7.0.142')//https://projects.neoforged.net/neoforged/neogradle
22+
id('net.neoforged.gradle.userdev') version('7.0.145')//https://projects.neoforged.net/neoforged/neogradle
2423
}
2524

2625
tasks.named('wrapper', Wrapper).configure {
@@ -243,29 +242,6 @@ minecraft.accessTransformers.files(
243242
file('src/gameTest/resources/META-INF/gametest_ats.cfg')
244243
)
245244

246-
static void setupClientAcc(Run run) {
247-
//The below if statements are to add args to your gradle.properties file in user home
248-
// (DO NOT add them directly to the gradle.properties file for this project)
249-
// Setting the below properties allows use of your normal Minecraft account in the
250-
// dev environment including having your skin load. Each property also has a comment
251-
// explaining what information to set the value to/format it expects
252-
// One thing to note is because of the caching that goes on, after changing these
253-
// variables, you need to refresh the project and rerun genIntellijRuns/genEclipseRuns
254-
if (run.project.hasProperty('mc_uuid')) {
255-
//Your uuid without any dashes in the middle
256-
run.programArguments.addAll('--uuid', (String) run.project.property('mc_uuid'))
257-
}
258-
if (run.project.hasProperty('mc_username')) {
259-
//Your username/display name, this is the name that shows up in chat
260-
// Note: This is not your email, even if you have a Mojang account
261-
run.programArguments.addAll('--username', (String) run.project.property('mc_username'))
262-
}
263-
if (run.project.hasProperty('mc_accessToken')) {
264-
//Your access token, you can find it in your '.minecraft/launcher_accounts.json' file
265-
run.programArguments.addAll('--accessToken', (String) run.project.property('mc_accessToken'))
266-
}
267-
}
268-
269245
runs {
270246
configureEach {
271247
if (hasProperty('forge_force_ansi')) {
@@ -285,11 +261,16 @@ runs {
285261
jvmArguments.add('-XX:+AllowEnhancedClassRedefinition')
286262
}
287263
}
288-
client { Run run -> setupClientAcc(run) }
264+
//Note: To enable logging into the client account, set the neogradle.subsystems.devLogin.conventionForRun property to true in your gradle user home
265+
// https://github.com/neoforged/NeoGradle?tab=readme-ov-file#per-run-configuration
266+
client {
267+
}
289268
clientAlt {
290269
configure('client')
291-
if (!project.hasProperty('mc_username')) {
292-
//If the property is missing (so the normal runClient task would use Dev as the name),
270+
//Force disable devLogin for clientAlt regardless of if it is enabled via gradle properties for the main gradle run
271+
devLogin.enabled(false)
272+
if (!(findProperty('neogradle.subsystems.devLogin.conventionForRun') ?: false)) {
273+
//If the property is missing or set to false (so the normal runClient task would use Dev as the name),
293274
// change the name of the alt client type so that it doesn't conflict with the main dev one
294275
programArguments.addAll((String[]) ['--username', 'AltDev'])
295276
}
@@ -299,9 +280,8 @@ runs {
299280
gameTestServer {
300281
modSources.add((SourceSet) sourceSets.gameTest)
301282
}
302-
gameTestClient { Run run ->
283+
gameTestClient {
303284
configure('client')
304-
setupClientAcc(run)
305285
modSources.add((SourceSet) sourceSets.gameTest)
306286
}
307287
junit {

0 commit comments

Comments
 (0)