mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 13:05:52 +08:00
Fix: Resolve hooks on launchers with remapped class loaders
Inject through the top-level orangexbridge package instead of imported cn.* names, build a fresh Javassist pool with agent-provided runtime class bytes, and fall back to safe class paths. Fixes Lunar GenesisClassLoader hook failures where resource class files still use obfuscated names.
This commit is contained in:
1 parent
cfb0ba4a48
commit
4b55871a8b
13 files changed
+344
-143
No files matched your search
@@ -0,0 +1,70 @@
|
||||
package orangexbridge;
|
||||
|
||||
import cn.xiaozhou233.orangex.event.facade.InputEvents;
|
||||
import cn.xiaozhou233.orangex.event.facade.Render2DEvents;
|
||||
import cn.xiaozhou233.orangex.event.facade.TickEvents;
|
||||
|
||||
/**
|
||||
* Injection bridge.
|
||||
*
|
||||
* <p>Injected Javassist snippets call this class by its fully-qualified name.
|
||||
* The package must not start with {@code cn}: vanilla 1.8.9 has an obfuscated
|
||||
* class named {@code cn} in the default package, which makes Javassist treat
|
||||
* {@code cn.xiaozhou233...} as a field access instead of a class name.</p>
|
||||
*
|
||||
* <p>Using a fixed full name also avoids depending on
|
||||
* {@code ClassPool#importPackage}, which can be unreliable on launchers with
|
||||
* custom class loaders.</p>
|
||||
*/
|
||||
public final class Hooks {
|
||||
|
||||
public static void tickPre() {
|
||||
TickEvents.firePre();
|
||||
}
|
||||
|
||||
public static void tickPost() {
|
||||
TickEvents.firePost();
|
||||
}
|
||||
|
||||
public static void render2d(Object context, boolean inWorld) {
|
||||
Render2DEvents.fire(context, inWorld);
|
||||
}
|
||||
|
||||
public static void render2d(Object context) {
|
||||
Render2DEvents.fire(context);
|
||||
}
|
||||
|
||||
public static void inputDraw(Object screen, int mouseX, int mouseY) {
|
||||
InputEvents.onDrawScreen(screen, mouseX, mouseY);
|
||||
}
|
||||
|
||||
public static boolean inputClick(Object screen, int mouseX,
|
||||
int mouseY, int button) {
|
||||
return InputEvents.onMouseClicked(screen, mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
public static boolean inputRelease(Object screen, int mouseX,
|
||||
int mouseY, int button) {
|
||||
return InputEvents.onMouseReleased(screen, mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
public static void inputDrag(Object screen, int mouseX,
|
||||
int mouseY, int button) {
|
||||
InputEvents.onMouseDragged(screen, mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
public static boolean inputKeyTyped(Object screen, int keyCode) {
|
||||
return InputEvents.onKeyTyped(screen, keyCode);
|
||||
}
|
||||
|
||||
public static void inputKeyPressed(int keyCode) {
|
||||
InputEvents.onKeyPressed(keyCode);
|
||||
}
|
||||
|
||||
public static boolean isOurScreen(Object screen) {
|
||||
return InputEvents.isOurInputScreen(screen);
|
||||
}
|
||||
|
||||
private Hooks() {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user