1.0.4
All checks were successful
FreshCoffee/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-10-20 12:11:56 -04:00
parent 7f828767a8
commit 47a9d6454f
3 changed files with 15 additions and 18 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
**1.0.4**
* Replace Reflection With New Fabric Loader API
* Enable Java Preview Features
**1.0.3** **1.0.3**
* Improve Java Binary Testing * Improve Java Binary Testing

View File

@ -3,14 +3,14 @@ org.gradle.jvmargs = -Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version = 1.16.2 minecraft_version = 1.16.3
curseforge_id = 398250 curseforge_id = 398250
simple_minecraft_version = 1.16.2 simple_minecraft_version = 1.16.3
yarn_build = 6 yarn_build = 47
fabric_loader_version = 0.9.0+build.204 fabric_loader_version = 0.10.3+build.211
# Mod Properties # Mod Properties
mod_version = 1.0.3 mod_version = 1.0.4
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

@ -1,16 +1,13 @@
package com.thebrokenrail.freshcoffee.util; package com.thebrokenrail.freshcoffee.util;
import com.thebrokenrail.freshcoffee.config.HardcodedConfig; import com.thebrokenrail.freshcoffee.config.HardcodedConfig;
import net.fabricmc.loader.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.game.MinecraftGameProvider;
import net.fabricmc.loader.util.Arguments;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -47,15 +44,7 @@ public final class ReLaunchUtil {
// Set Entry-Point // Set Entry-Point
mainArgs.add(Util.getMainClass()); mainArgs.add(Util.getMainClass());
// Get Parameters // Get Parameters
String[] launchArgs; String[] launchArgs = FabricLoader.getInstance().getLaunchArguments(false);
try {
Field launchArgsField = MinecraftGameProvider.class.getDeclaredField("arguments");
launchArgsField.setAccessible(true);
//noinspection deprecation
launchArgs = ((Arguments) launchArgsField.get(FabricLoader.INSTANCE.getGameProvider())).toArray();
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException(e);
}
// Add Parameters // Add Parameters
mainArgs.addAll(Arrays.asList(launchArgs)); mainArgs.addAll(Arrays.asList(launchArgs));
return mainArgs; return mainArgs;
@ -68,6 +57,10 @@ public final class ReLaunchUtil {
List<String> vmArgs = new ArrayList<>(ManagementFactory.getRuntimeMXBean().getInputArguments()); List<String> vmArgs = new ArrayList<>(ManagementFactory.getRuntimeMXBean().getInputArguments());
// Remove Debugger // Remove Debugger
vmArgs.removeIf(arg -> arg.startsWith("-agentlib") || arg.startsWith("-javaagent")); vmArgs.removeIf(arg -> arg.startsWith("-agentlib") || arg.startsWith("-javaagent"));
// Enable Java Preview Features
if (!vmArgs.contains("--enable-preview")) {
vmArgs.add("--enable-preview");
}
List<String> mainArgs = getMainArgs(); List<String> mainArgs = getMainArgs();