mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 13:05:52 +08:00
Refactor: Compatible with JuiceAgent V3.0 b2
This commit is contained in:
1 parent
f0ebdea5ed
commit
42eaee6040
10 files changed
+10
-9
No files matched your search
Generated
+1
@@ -15,6 +15,7 @@
|
||||
<option value="$PROJECT_DIR$/OrangeX" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
+1
-1
@@ -11,5 +11,5 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(files("../libraries/JuiceLoader.jar"))
|
||||
compileOnly(files("../libraries/JuiceAgent-API-1.4.0+build.1.jar"))
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.xiaozhou233.orangex.loader;
|
||||
|
||||
|
||||
import cn.xiaozhou233.juiceloader.JuiceLoader;
|
||||
import cn.xiaozhou233.juiceagent.api.JuiceAgent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Loader {
|
||||
// Load OrangeX
|
||||
File injectionFile = new File(userDir + "/.orangex/OrangeX.jar");
|
||||
System.out.println("OrangeX Injection: " + injectionFile.getAbsolutePath());
|
||||
JuiceLoader.AddToClassLoader(injectionFile.getAbsolutePath(), minecraftClassLoader);
|
||||
JuiceAgent.addToClassLoader(injectionFile.getAbsolutePath(), minecraftClassLoader);
|
||||
|
||||
// Start OrangeX
|
||||
try {
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.xiaozhou233.orangex.mixin.impl.MixinEntityRenderer;
|
||||
import cn.xiaozhou233.orangex.mixin.impl.MixinGuiIngame;
|
||||
import cn.xiaozhou233.orangex.mixin.impl.MixinMinecraft;
|
||||
import cn.xiaozhou233.orangex.mixin.impl.MixinNetHandlerPlayClient;
|
||||
import cn.xiaozhou233.orangex.utils.JuiceLoaderFacade;
|
||||
import cn.xiaozhou233.orangex.utils.JuiceAgentFacade;
|
||||
import cn.yapeteam.ymixin.Transformer;
|
||||
import cn.yapeteam.ymixin.YMixin;
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class MixinManager {
|
||||
}
|
||||
},
|
||||
clazz -> {
|
||||
byte[] classBytes = JuiceLoaderFacade.getClassBytes(clazz);
|
||||
byte[] classBytes = JuiceAgentFacade.getClassBytes(clazz);
|
||||
if (classBytes == null) {
|
||||
throw new RuntimeException(
|
||||
"ClassBytes null: " + clazz.getName()
|
||||
@@ -53,7 +53,7 @@ public final class MixinManager {
|
||||
transformer.transform().forEach((name, bytes) -> {
|
||||
try {
|
||||
Class<?> targetClass = Class.forName(name, false, cl);
|
||||
boolean ok = JuiceLoaderFacade.redefineClass(targetClass, bytes);
|
||||
boolean ok = JuiceAgentFacade.redefineClass(targetClass, bytes);
|
||||
if (!ok) {
|
||||
throw new RuntimeException("Redefine failed: " + name);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ package cn.xiaozhou233.orangex.utils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public final class JuiceLoaderFacade {
|
||||
public final class JuiceAgentFacade {
|
||||
|
||||
private static final Class<?> JL;
|
||||
private static final Method INIT;
|
||||
@@ -13,7 +13,7 @@ public final class JuiceLoaderFacade {
|
||||
static {
|
||||
try {
|
||||
JL = Class.forName(
|
||||
"cn.xiaozhou233.juiceloader.JuiceLoader",
|
||||
"cn.xiaozhou233.juiceagent.api.JuiceAgent",
|
||||
true,
|
||||
ClassLoader.getSystemClassLoader()
|
||||
);
|
||||
@@ -33,7 +33,7 @@ public final class JuiceLoaderFacade {
|
||||
}
|
||||
}
|
||||
|
||||
private JuiceLoaderFacade() {}
|
||||
private JuiceAgentFacade() {}
|
||||
|
||||
public static byte[] getClassBytes(Class<?> clazz) {
|
||||
try {
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user