CCBlueX / LiquidBounce

A free mixin-based injection hacked client for Minecraft using the Fabric API
https://liquidbounce.net/
GNU General Public License v3.0
1.52k stars 488 forks source link

[BUG] reflectionUtil uses unmapped names #1916

Closed fineless71 closed 10 months ago

fineless71 commented 10 months ago

LiquidBounce Branch

Nextgen

LiquidBounce Build/Version

0.1.2

Operating System

Linux

Minecraft Version

1.20.4

Describe the bug

You cannot use mapped names using the reflection util:

// Works
const PlayerMoveC2SPacket = reflectionUtil.classByName("net.minecraft.class_2828");
// Doesn't work, causes error
const PlayerMoveC2SPacket = reflectionUtil.classByName("net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket");

Steps to reproduce

Try to use mapped names with the reflection util (moved to an issue, originally from https://github.com/CCBlueX/LiquidBounce/issues/1811#issuecomment-1913283445)

Client Log

org.graalvm.polyglot.PolyglotException: net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket
    at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:226) ~[fabric-loader-0.15.3.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) ~[fabric-loader-0.15.3.jar:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:375) ~[?:?]
    at net.ccbluex.liquidbounce.script.bindings.api.JsReflectionUtil.classByName(JsReflectionUtil.kt:24) ~[liquidbounce.jar:?]
    at <js>.:program(Unnamed:10) ~[?:?]
    at org.graalvm.polyglot.Context.eval(Context.java:429) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.Script.initScript(Script.kt:74) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadScript(ScriptManager.kt:67) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadSafely(ScriptManager.kt:57) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadScripts(ScriptManager.kt:42) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.reloadScripts(ScriptManager.kt:121) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.CommandScript$createCommand$1.invoke(CommandScript.kt:36) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.CommandScript$createCommand$1.invoke(CommandScript.kt:34) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandManager.execute(CommandManager.kt:322) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandExecutor$chatEventHandler$1.invoke(CommandManager.kt:59) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandExecutor$chatEventHandler$1.invoke(CommandManager.kt:56) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.event.EventManager.callEvent(EventManager.kt:169) ~[liquidbounce.jar:?]
    at net.minecraft.class_408.handler$clk000$liquidbounce$handleChatMessage(class_408.java:1551) ~[client-intermediary.jar:?]
    at net.minecraft.class_408.method_44056(class_408.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_408.method_25404(class_408.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_1454(class_309.java:407) ~[client-intermediary.jar:?]
    at net.minecraft.class_437.method_25412(class_437.java:414) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_1466(class_309.java:403) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_22678(class_309.java:492) ~[client-intermediary.jar:?]
    at net.minecraft.class_1255.execute(class_1255.java:102) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.redirect$cah000$viafabricplus$storeEvent(class_309.java:1136) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_22676(class_309.java:492) ~[client-intermediary.jar:?]
    at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44) ~[lwjgl-glfw-3.3.2.jar:?]
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.2.jar:?]
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3438) ~[lwjgl-glfw-3.3.2.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:202) ~[client-intermediary.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:220) ~[client-intermediary.jar:?]
    at net.minecraft.class_1041.method_15998(class_1041.java:287) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1349) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:888) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:265) ~[minecraft-1.20.4-client.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.3.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.3.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.3.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
    at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104) ~[NewLaunch.jar:?]
    at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176) ~[NewLaunch.jar:?]
    at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186) ~[NewLaunch.jar:?]
    at org.polymc.EntryPoint.listen(EntryPoint.java:144) ~[NewLaunch.jar:?]
    at org.polymc.EntryPoint.main(EntryPoint.java:74) ~[NewLaunch.jar:?]

Screenshots

No response

1zun4 commented 10 months ago

Please try now :)

fineless71 commented 10 months ago

Hmm, now I'm getting this:

const PlayerMoveC2SPacket = reflectionUtil.classByName("net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket");
org.graalvm.polyglot.PolyglotException: net/minecraft/class_2828
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:375) ~[?:?]
    at net.ccbluex.liquidbounce.script.bindings.api.JsReflectionUtil.classByName(JsReflectionUtil.kt:26) ~[liquidbounce.jar:?]
    at <js>.:program(Unnamed:9) ~[?:?]
    at org.graalvm.polyglot.Context.eval(Context.java:429) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.Script.initScript(Script.kt:74) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadScript(ScriptManager.kt:67) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadSafely(ScriptManager.kt:57) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.loadScripts(ScriptManager.kt:42) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.ScriptManager.reloadScripts(ScriptManager.kt:121) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.CommandScript$createCommand$1.invoke(CommandScript.kt:36) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.script.CommandScript$createCommand$1.invoke(CommandScript.kt:34) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandManager.execute(CommandManager.kt:322) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandExecutor$chatEventHandler$1.invoke(CommandManager.kt:59) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.features.command.CommandExecutor$chatEventHandler$1.invoke(CommandManager.kt:56) ~[liquidbounce.jar:?]
    at net.ccbluex.liquidbounce.event.EventManager.callEvent(EventManager.kt:169) ~[liquidbounce.jar:?]
    at net.minecraft.class_408.handler$clk000$liquidbounce$handleChatMessage(class_408.java:1551) ~[client-intermediary.jar:?]
    at net.minecraft.class_408.method_44056(class_408.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_408.method_25404(class_408.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_1454(class_309.java:407) ~[client-intermediary.jar:?]
    at net.minecraft.class_437.method_25412(class_437.java:414) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_1466(class_309.java:403) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_22678(class_309.java:492) ~[client-intermediary.jar:?]
    at net.minecraft.class_1255.execute(class_1255.java:102) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.redirect$cah000$viafabricplus$storeEvent(class_309.java:1136) ~[client-intermediary.jar:?]
    at net.minecraft.class_309.method_22676(class_309.java:492) ~[client-intermediary.jar:?]
    at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44) ~[lwjgl-glfw-3.3.2.jar:?]
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.2.jar:?]
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3438) ~[lwjgl-glfw-3.3.2.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:202) ~[client-intermediary.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:220) ~[client-intermediary.jar:?]
    at net.minecraft.class_1041.method_15998(class_1041.java:287) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1349) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:888) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:265) ~[minecraft-1.20.4-client.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.3.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.3.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.3.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
    at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104) ~[NewLaunch.jar:?]
    at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176) ~[NewLaunch.jar:?]
    at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186) ~[NewLaunch.jar:?]
    at org.polymc.EntryPoint.listen(EntryPoint.java:144) ~[NewLaunch.jar:?]
    at org.polymc.EntryPoint.main(EntryPoint.java:74) ~[NewLaunch.jar:?]

It needs to replace the slashes with dots

1zun4 commented 10 months ago

My bad.