aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-11-01 18:50:11 +0100
committernea <nea@nea.moe>2023-11-01 18:50:11 +0100
commit297cb01f220a617dd08096467978b2fccbc27695 (patch)
treed467f358313ce3648063da41b66361a840fa7864 /src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
parentd5253dc5c3ae7b2cc1fcb96780e43b929a449eb4 (diff)
downloadModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.tar.gz
ModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.tar.bz2
ModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.zip
Add documentation
Diffstat (limited to 'src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java')
-rw-r--r--src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java b/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
index 3c32931..f7431ad 100644
--- a/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
+++ b/src/main/java/moe/nea/modernjava/launch/FCPEntryPoint.java
@@ -1,16 +1,25 @@
package moe.nea.modernjava.launch;
+import moe.nea.modernjava.launch.live.FCPFixTweaker;
import moe.nea.modernjava.launch.util.ClassLoaderManipulations;
+import moe.nea.modernjava.launch.util.WellKnownBlackboard;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import java.net.URI;
import java.util.List;
import java.util.Map;
+import static moe.nea.modernjava.launch.util.PropertyNames.HAS_RELAUNCHED;
+/**
+ * Global entrypoint for both the FML part of the relaunched (live) and the relaunching (relaunch) runs. Execution
+ * begins during static initialization to be as early as possible. There aren't any security implications, but especially
+ * on Windows it can be problematic if two processes try to open up the same file, so we try to avoid these conflicts.
+ * Also, it's just a faster launch.
+ */
@IFMLLoadingPlugin.Name("ModernJavaRelauncher")
public class FCPEntryPoint implements IFMLLoadingPlugin {
- static URI fileUri;
+ public static URI fileUri;
static {
try {
@@ -18,9 +27,10 @@ public class FCPEntryPoint implements IFMLLoadingPlugin {
} catch (Exception e) {
throw new RuntimeException(e);
}
- if (System.getProperty("modernjava.hasrelaunched") == null) {
+ if (System.getProperty(HAS_RELAUNCHED) == null) {
try {
- Class.forName("moe.nea.modernjava.launch.FCPRelauncher").getMethod("relaunch").invoke(null);
+ Class.forName("moe.nea.modernjava.launch.relaunch.FCPRelauncher")
+ .getMethod("relaunch").invoke(null);
} catch (Throwable t) {
System.out.println("Failed to relaunch");
t.printStackTrace();
@@ -32,7 +42,7 @@ public class FCPEntryPoint implements IFMLLoadingPlugin {
throw new RuntimeException(e);
}
List<String> tweakClasses = WellKnownBlackboard.tweakerNames();
- tweakClasses.add(FCPMixinAwareTweaker.class.getName());
+ tweakClasses.add(FCPFixTweaker.class.getName());
}
}