-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ScriptAPI mapping issue with method overloading #4964
Comments
(I was asked to ping @commandblock2 here) |
Also, I forgot to mention that it usually seems to "want" the method with most parameters. |
I do remember seeing this a few days ago, Method Selection for graaljs. I am not sure if this will help u, because the problem may involve remapping and the error is not found in the following doc. I will try this as soon as I build and run LiquidBounce. |
Haha, I can't get this syntax to even work, no matter how many arguments I specify. ¯\(ツ)/¯ |
I modified a bit of your script console.log(event);
console.log(event.context);
console.log(event.context.drawGuiTexture); and found that the problem cannot be fully reproduced in a develop envrionment (LiquidBounce launched with gradle/idea), because the mapping might not be the same as the production environment? not sure at the moment. For the first
I will try if I can reproduce this later tomorrow if I launch LB from a normal environment. btw I am using openjdk not the new default graalvm for this one, so not sure what what is happening. Hope this information could be useful for further deep dive. |
Also a bit for the workaround, you can use the reflection api hack to try to call those functions, I have some old scripts, they are not built for the current api but the reflection code should function the same (didn't try tho). For example in this old script made for script api v1 1.8.9 with out-dated Core.lib, the code uses |
Core has an utility called Reflector which remaps calls and calls methods which have matching parameter types, might be useful. |
Welp, I can see that I can get around this, but isn't it still a bug? So, shall I close the issue? |
Also a correction, for Later now that I can totally reproduce 2/2 of your problems in the production environment with the LBNG I just compiled. And your comment is indeed very right. There might be a workaround but I would treat it as a bug or something, if I were u I would keep it open. Going to take a look at the remapper implementation and see if I could do anything. |
Just in these two days I found there is indeed a built-in
see https://github.com/CCBlueX/LiquidBounce/blob/1199618a72206fe7606a9e92212a5651c4d66876/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptReflectionUtil.kt#L71-77 |
LiquidBounce Branch
Nextgen
LiquidBounce Build/Version
0.22.0
Operating System
Windows 10
Minecraft Version
1.21.1
Describe the bug
Hello, I've found out that when calling certain methods in DrawContext, other methods with the same name (but different parameters) are called.
In the provided script, I try to call method_52706 (with the parameters
Identifier texture, int x, int y, int width, int height
), but method_52709 (with the parametersIdentifier texture, int int2, int int3, int int4, int int5, int x, int y, int z, int width, int height
) gets called instead (I'm presuming this on the amount of expected arguments).I used this version of Yarn JavaDocs for DrawContext as my reference for the methods and their parameters. I remember getting the link to this specific version somewhere in the ScriptAPI docs or possibly on the forum, but I can't say for sure as I cannot find it anymore, sorry :/
Here's my script:
Steps to reproduce
Client Log
Screenshots
The text was updated successfully, but these errors were encountered: