Skip to content

Commit

Permalink
Address comments, and add a way to default configure whether it is en…
Browse files Browse the repository at this point in the history
…abled system-wide or not.
  • Loading branch information
marchermans committed May 29, 2024
1 parent 7f1af80 commit bdab11f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ More information on the relevant tool, its released version and documentation ca

## DevLogin
The DevLogin tool is a tool that allows you to log in to a Minecraft account without having to use the Minecraft launcher, during development.
By default, it will use the credentials stored by the vanilla launcher, however if you are not logged in there, it will offer you the ability to log in directly from the console.
This tool is used by the runs subsystem to enable logged in plays on all client runs.
The tool can be configured using the following properties:
```properties
Expand All @@ -391,6 +392,12 @@ By default, the dev login tool is disabled, and can only be enabled for client r
> [!WARNING]
> If you enable the dev login tool for a non-client run, you will get an error message.
If you want to enable the dev login tool for all client runs, you can set the following property in your gradle.properties:
```properties
neogradle.subsystems.devLogin.conventionForRun=true
```
This will enable the dev login tool for all client runs, unless explicitly disabled.

### Configurations
To add the dev login tool to your run we create a custom configuration to which we add the dev login tool.
This configuration is created for the first source-set you register with the run as a mod source set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ private void configureDevLoginDefaults() {
devLogin.getConfigurationSuffix().convention(
getStringProperty("devLogin.configurationSuffix").orElse("DevLoginLocalOnly")
);
devLogin.getConventionForRun().convention(
getBooleanProperty("devLogin.conventionForRun").orElse(false)
);
}

private void configureToolsDefaults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.collect.Sets;
import net.minecraftforge.gdi.ConfigurableDSLElement;
import net.neoforged.gradle.common.util.constants.RunsConstants;
import net.neoforged.gradle.dsl.common.extensions.subsystems.Subsystems;
import net.neoforged.gradle.dsl.common.runs.run.Run;
import net.neoforged.gradle.dsl.common.runs.type.RunType;
import net.neoforged.gradle.util.StringCapitalizationUtils;
Expand Down Expand Up @@ -61,7 +62,10 @@ public RunImpl(final Project project, final String name) {

getWorkingDirectory().convention(project.getLayout().getProjectDirectory().dir("runs").dir(getName()));

getUseDevLogin().convention(false);
getUseDevLogin().convention(
project.getExtensions().getByType(Subsystems.class).getDevLogin().getConventionForRun()
.zip(getIsClient(), (devLogin, isClient) -> devLogin && isClient)
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ interface DevLogin extends ConfigurableDSLElement<DevLogin> {
@Optional
@DSLProperty
Property<String> getConfigurationSuffix()

/**
* @return The default usage flag state for runs. This is by default false (meaning the dev login configuration is not used by default), setting this to true will make all clients use dev login by default.
*/
@Input
@Optional
@DSLProperty
Property<Boolean> getConventionForRun()
}

0 comments on commit bdab11f

Please sign in to comment.