Skip to content

Commit

Permalink
Remove launch targets
Browse files Browse the repository at this point in the history
Remove JUnit run type
  • Loading branch information
shartte committed Jan 1, 2025
1 parent 5ad59ec commit bda6cc2
Showing 1 changed file with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,21 @@ public void writeUserDevConfig() throws IOException {
);

for (var runType : RunType.values()) {
var launchTarget = switch (runType) {
case CLIENT -> "neoforgeclientdev";
case CLIENT_DATA -> "neoforgeclientdatadev";
case SERVER_DATA -> "neoforgeserverdatadev";
case GAME_TEST_SERVER, SERVER -> "neoforgeserverdev";
case JUNIT -> "neoforgejunitdev";
var mainClass = switch (runType) {
case CLIENT -> "net.neoforged.fml.startup.Client";
case CLIENT_DATA -> "net.neoforged.fml.startup.DataClient";
case SERVER_DATA -> "net.neoforged.fml.startup.DataServer";
case GAME_TEST_SERVER, SERVER -> "net.neoforged.fml.startup.Server";
};

List<String> args = new ArrayList<>();
Collections.addAll(args, "--launchTarget", launchTarget);

if (runType == RunType.CLIENT || runType == RunType.JUNIT) {
if (runType == RunType.CLIENT) {
// TODO: this is copied from NG but shouldn't it be the MC version?
Collections.addAll(args, "--version", getNeoForgeVersion().get());
}

if (runType == RunType.CLIENT || runType == RunType.CLIENT_DATA || runType == RunType.JUNIT) {
if (runType == RunType.CLIENT || runType == RunType.CLIENT_DATA) {
Collections.addAll(args,
"--assetIndex", "{asset_index}",
"--assetsDir", "{assets_root}");
Expand All @@ -115,13 +113,6 @@ public void writeUserDevConfig() throws IOException {
Map<String, String> systemProperties = new LinkedHashMap<>();
systemProperties.put("java.net.preferIPv6Addresses", "system");

String mainClass = switch (runType) {
case CLIENT -> "net.neoforged.fml.startup.Client";
case CLIENT_DATA -> "net.neoforged.fml.startup.DataClient";
case SERVER_DATA -> "net.neoforged.fml.startup.DataServer";
case SERVER, GAME_TEST_SERVER -> "net.neoforged.fml.startup.Server";
case JUNIT -> null;
};
if (runType == RunType.CLIENT || runType == RunType.GAME_TEST_SERVER) {
systemProperties.put("neoforge.enableGameTest", "true");

Expand All @@ -131,19 +122,19 @@ public void writeUserDevConfig() throws IOException {
}

config.runs().put(runType.jsonName, new UserDevRunType(
runType != RunType.JUNIT,
true,
mainClass,
args,
List.of(
"--add-opens", "java.base/java.util.jar=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.util=ALL-UNNAMED",
"--add-exports", "jdk.naming.dns/com.sun.jndi.dns=java.naming"),
runType == RunType.CLIENT || runType == RunType.JUNIT || runType == RunType.CLIENT_DATA,
runType == RunType.CLIENT || runType == RunType.CLIENT_DATA,
runType == RunType.GAME_TEST_SERVER || runType == RunType.SERVER || runType == RunType.SERVER_DATA,
runType == RunType.CLIENT_DATA || runType == RunType.SERVER_DATA,
runType == RunType.CLIENT || runType == RunType.GAME_TEST_SERVER,
runType == RunType.JUNIT,
false,
Map.of("MOD_CLASSES", "{source_roots}"),
systemProperties
));
Expand All @@ -161,8 +152,7 @@ private enum RunType {
CLIENT_DATA("clientData"),
SERVER_DATA("serverData"),
GAME_TEST_SERVER("gameTestServer"),
SERVER("server"),
JUNIT("junit");
SERVER("server");

private final String jsonName;

Expand Down

0 comments on commit bda6cc2

Please sign in to comment.