diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 14746e7..26070dc 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,12 +4,14 @@
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0c96419..f8404f1 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/Loader/build.gradle b/Loader/build.gradle
new file mode 100644
index 0000000..8942dde
--- /dev/null
+++ b/Loader/build.gradle
@@ -0,0 +1,19 @@
+plugins {
+ id 'java'
+ id("com.gradleup.shadow") version "8.3.11"
+}
+
+group = 'cn.xiaozhou233.orangex.injector'
+version = 'unspecified'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation files("../libraries/JuiceAgent-API-1.4.1+build.1.jar")
+}
+
+test {
+ useJUnitPlatform()
+}
\ No newline at end of file
diff --git a/Loader/src/main/java/cn/xiaozhou233/orangex/loader/Loader.java b/Loader/src/main/java/cn/xiaozhou233/orangex/loader/Loader.java
new file mode 100644
index 0000000..7ec0b33
--- /dev/null
+++ b/Loader/src/main/java/cn/xiaozhou233/orangex/loader/Loader.java
@@ -0,0 +1,63 @@
+package cn.xiaozhou233.orangex.loader;
+
+import cn.xiaozhou233.juiceagent.api.JuiceAgent;
+
+import java.io.File;
+
+public class Loader {
+ public static final String VERSION = "1.0.0-SNAPSHOT";
+ public static final String ORANGEX_CLASS = "cn.xiaozhou233.orangex.OrangeX";
+
+ public static String OrangeXPath = new File(System.getProperty("user.home")+"/.orangex").getAbsolutePath();
+ public static Thread clientThread;
+ public static ClassLoader minecraftClassLoader;
+
+ public static void entry() {
+ System.out.println("OrangeX-Loader " + VERSION + " loaded!");
+
+ // Find client thread
+ for (Thread t : Thread.getAllStackTraces().keySet()) {
+ if ("Client thread".equals(t.getName())) {
+ clientThread = t;
+ break;
+ }
+ }
+ if (clientThread == null) {
+ throw new IllegalStateException("Cannot find Minecraft client thread");
+ }
+
+ // Get Minecraft ClassLoader
+ minecraftClassLoader = clientThread.getContextClassLoader();
+ System.out.println("Minecraft ClassLoader: " + minecraftClassLoader);
+
+ // Dev Only: Load JuiceAgent
+ if (isDevEnvironment()) {
+ System.load(new File("../../natives/libagent.dll").getAbsolutePath());
+ JuiceAgent.init("");
+ }
+
+ // Load OrangeX
+ File orangexFile;
+ if (isDevEnvironment()) {
+ orangexFile = new File("../../out/tmp/OrangeX.jar");
+ } else {
+ orangexFile = new File(OrangeXPath + "/OrangeX.jar");
+ }
+ System.out.println("OrangeX Injection: " + orangexFile.getAbsolutePath());
+ JuiceAgent.addToClassLoader(orangexFile.getAbsolutePath(), minecraftClassLoader);
+
+ // Start OrangeX
+ try {
+ Class> orangeX = Class.forName(ORANGEX_CLASS, true, minecraftClassLoader);
+ Object orangeXInstance = orangeX.getMethod("getInstance").invoke(null);
+ orangeX.getMethod("start").invoke(orangeXInstance);
+ } catch (Exception e) {
+ System.err.println("Failed to invoke OrangeX start!");
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static boolean isDevEnvironment() {
+ return Boolean.getBoolean("orangex.dev");
+ }
+}
\ No newline at end of file
diff --git a/libraries/JuiceAgent-API-1.4.1+build.1.jar b/libraries/JuiceAgent-API-1.4.1+build.1.jar
new file mode 100644
index 0000000..72d96d3
Binary files /dev/null and b/libraries/JuiceAgent-API-1.4.1+build.1.jar differ
diff --git a/settings.gradle b/settings.gradle
index f00aa1b..51bdb22 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,2 @@
rootProject.name = 'OrangeX-Client'
-
+include 'Loader'