Fix DLI not applying to multiword NeoForge envs like dataClient

Fixes #268. All the environments are now lowercase which should
be fine.

Additionally, reverts commits 127345ea and 07f91bfd
since the workaround is no longer needed and causes a crash.
This commit is contained in:
Juuz
2025-03-04 18:27:24 +02:00
parent 07f91bfd0b
commit 7204a7d4f3
2 changed files with 7 additions and 9 deletions

View File

@@ -116,13 +116,6 @@ public record ForgeRunTemplate(
settings.getEnvironmentVariables().putIfAbsent(key, resolved);
});
// TODO: Also remove this hack once DLI supports clientData as the env
if (this.name.equals("dataClient") || this.name.equals("dataServer")) {
for (ConfigValue arg : args) {
settings.programArg(arg.resolve(configValueResolver));
}
}
// Add MOD_CLASSES, this is something that ForgeGradle does
settings.getEnvironmentVariables().computeIfAbsent("MOD_CLASSES", $ -> ConfigValue.of("{source_roots}").resolve(configValueResolver));
}

View File

@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -272,12 +273,16 @@ public abstract class GenerateDLIConfigTask extends AbstractLoomTask {
}
for (ForgeRunTemplate.Resolved template : getRunTemplates().get()) {
// Note: lowercase to match RunConfig which lowercases all user input for
// RunConfigSettings.environment
var env = template.name().toLowerCase(Locale.ROOT);
for (String argument : template.args()) {
launchConfig.argument(template.name(), argument);
launchConfig.argument(env, argument);
}
for (Map.Entry<String, String> property : template.props().entrySet()) {
launchConfig.property(template.name(), property.getKey(), property.getValue());
launchConfig.property(env, property.getKey(), property.getValue());
}
}
}