Skip to content
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] invokeMethod in ScriptReflectionUtil cannot correctly filter method based on args #5030

Closed
commandblock2 opened this issue Dec 23, 2024 · 1 comment
Labels
🐛 bug Something isn't working 🌑 nextgen
Milestone

Comments

@commandblock2
Copy link
Contributor

LiquidBounce Branch

Nextgen

LiquidBounce Build/Version

git-5d29ed9

Operating System

Linux

Minecraft Version

1.21.1

Describe the bug

This script does not work, specifically this line ReflectionUtil.invokeMethod(event.context, "fill", 100, 100, 200, 200, -1); does not work.

const script = registerScript({
  name: "IssueExample",
  version: "1.0.0",
  authors: ["Ajax"]
});

script.registerModule({
  name: "IssueExample_drawGuiTexture",
  category: "Client",
  description: "Sausage"
}, (mod) => {

  mod.on("overlayRender", (event) => {
    if (!mc.player || !mc.world)
      return;

    // Should map to method_52706, but (probably) maps to method_52709
    // inb4 some smartass goes "oh this is because of null!1!", no
    console.log(event);
    console.log(event.context);
    console.log(event.context.drawGuiTexture);
    ReflectionUtil.invokeMethod(event.context, "drawGuiTexture", null, 100, 100, 200, 200);   
  })
});

script.registerModule({
  name: "IssueExample_fill",
  category: "Client",
  description: "Sausage"
}, (mod) => {

  mod.on("overlayRender", (event) => {
    if (!mc.player || !mc.world)
      return;

    // Should map to method_25294, but (probably) maps to method_51737
    console.log(event);
    console.log(event.context);
    console.log(event.context.fill); 
    ReflectionUtil.invokeMethod(event.context, "fill", 100, 100, 200, 200, -1);   
  })
});

Steps to reproduce

  • save the script as a js file in the script folder (either from a launcher or gradle)
  • launch LB
  • enable module IssueExample_fill
  • expect to see a white square rendering on screen, actually see visible drops in FPS.

Client Log

Should not be relevant but here it is. 

[1224/002150.320561:INFO:CONSOLE(1)] "Connecting to server at:  ws://127.0.0.1:15000", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.320636:INFO:CONSOLE(1)] "Connecting to server at:  ws://127.0.0.1:15000", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.321882:INFO:CONSOLE(1)] "Connecting to server at:  ws://127.0.0.1:15000", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.442759:INFO:CONSOLE(1)] "[WS] Cleaned up event listeners", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ: [id: 0x09fbd30d, L:/127.0.0.1:15000 - R:/127.0.0.1:55420]
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ COMPLETE
[1224/002150.446258:INFO:CONSOLE(70)] "[Router] Redirecting to none", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (70)
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ: [id: 0x990eaac5, L:/127.0.0.1:15000 - R:/127.0.0.1:55436]
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ COMPLETE
[1224/002150.591651:INFO:CONSOLE(1)] "[WS] Connected to server", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ: [id: 0x7c96e7b1, L:/127.0.0.1:15000 - R:/127.0.0.1:55446]
[00:21:50] [epollEventLoopGroup-3-1/INFO]: [id: 0xb89b270c, L:/[0:0:0:0:0:0:0:0%0]:15000] READ COMPLETE
[1224/002150.726969:INFO:CONSOLE(1)] "[WS] Connected to server", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.730223:INFO:CONSOLE(1)] "[WS] Connected to server", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.954701:INFO:CONSOLE(1)] "[WS] Cleaned up event listeners", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (1)
[1224/002150.954795:INFO:CONSOLE(70)] "[Router] Redirecting to none", source: http://127.0.0.1:15000/default/assets/index-UJQXIsl_.js (70)
[1224/002154.073295:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002154.074263:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002201.133120:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002201.133409:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002201.136948:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002201.137180:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002202.282923:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002202.283090:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002202.301153:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[1224/002202.301436:WARNING:keyboard_code_conversion_x.cc(1462)] Unknown keycode:0
[00:23:03] [Render thread/INFO]: Successfully saved config 'modules'.
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@3d67c730
net.minecraft.class_332@4145f150
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@1e1a38aa
net.minecraft.class_332@9d56d53
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@652788bd
net.minecraft.class_332@46bf5c2e
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@2bb2b8a8
net.minecraft.class_332@7209af03
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@382bc79d
net.minecraft.class_332@6624fc8
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@392c89b0
net.minecraft.class_332@29cdac06
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@688e872
net.minecraft.class_332@4261d939
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@69fa1801
net.minecraft.class_332@16ec8fe0
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@57663e37
net.minecraft.class_332@1b828df3
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@39735924
net.minecraft.class_332@16f9cfac
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@783b1a58
net.minecraft.class_332@5b22c602
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@37ee665
net.minecraft.class_332@cb8f3cc
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@15179f0d
net.minecraft.class_332@5e7a38f0
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@7ca7c5ff
net.minecraft.class_332@6d1ce8f0
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@4b68f07a
net.minecraft.class_332@9224cd5
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@3d3afc00
net.minecraft.class_332@5230efe2
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@312fb58
net.minecraft.class_332@56085b27
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@19270183
net.minecraft.class_332@66fe64f7
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@6667274b
net.minecraft.class_332@47ed191d
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@522104cb
net.minecraft.class_332@34bfb517
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@2e8b4595
net.minecraft.class_332@60760881
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@7b141f78
net.minecraft.class_332@7f5f52ab
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@116e2215
net.minecraft.class_332@4ada109f
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@7063d8ac
net.minecraft.class_332@107d323f
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@ab99647
net.minecraft.class_332@6b86b884
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@3a9637ce
net.minecraft.class_332@640afa80
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@347d1586
net.minecraft.class_332@3f5e6c80
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@42744b51
net.minecraft.class_332@1ef9a7bc
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@770b0678
net.minecraft.class_332@5a3d198c
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@d984477
net.minecraft.class_332@4dcc40c5
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@3089dfb4
net.minecraft.class_332@f538bc0
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@1cac9bf8
net.minecraft.class_332@fb21e26
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@1bb3f8b7
net.minecraft.class_332@4d208a82
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@67b80859
net.minecraft.class_332@fa760b8
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@1bc507e4
net.minecraft.class_332@1add66e6
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@9964a8c
net.minecraft.class_332@3a5f867d
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@4ffb5493
net.minecraft.class_332@9d14f7f
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@265fa13
net.minecraft.class_332@172f7900
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@68b7b278
net.minecraft.class_332@45af681f
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@6594f1ef
net.minecraft.class_332@6b4849f8
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@768120ef
net.minecraft.class_332@5f2fb04e
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@2ef6800
net.minecraft.class_332@206005d3
function () { [native code] }
net.ccbluex.liquidbounce.event.events.OverlayRenderEvent@57adcf0b
net.minecraft.class_332@1f3b9a7a
function () { [native code] }
[00:23:20] [Render thread/INFO]: Successfully saved config 'modules'.

Screenshots

image
image

@github-actions github-actions bot added 🌑 nextgen 🐛 bug Something isn't working labels Dec 23, 2024
@commandblock2
Copy link
Contributor Author

commandblock2 commented Dec 23, 2024

First I swapped name and method.name as shown in the screenshot, and placed a breakpoint in the next line, after the change the break point was hit 4 times/invokeMethod call with the previous args (4 overloads in that class). Only the one in the screenshot seems to be one having a signature that matches the args, but one type is int and the other is class java.lang.Integer so they aren't equal. We might need a dedicated function for matching the args that can be null or primitive types. Not yet sure where the performance hit comes from, could be printing or this function calling, will do a profiling later.
image

@commandblock2 commandblock2 changed the title [BUG] invokeMethod in ScriptReflectionUtil cannot correctly filter method based on args (and potentially other methods) [BUG] invokeMethod in ScriptReflectionUtil cannot correctly filter method based on args (and potentially other methods) Dec 23, 2024
@commandblock2 commandblock2 changed the title [BUG] invokeMethod in ScriptReflectionUtil cannot correctly filter method based on args (and potentially other methods) [BUG] invokeMethod in ScriptReflectionUtil cannot correctly filter method based on args Dec 23, 2024
@1zun4 1zun4 added this to the 0.24.0 milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🌑 nextgen
Projects
None yet
Development

No branches or pull requests

2 participants