How to tell a module is on or off?
-
@commandblock2
do this.minecraft/LiquidBounce-1.8 $ grep framebufferMc mcp-stable_22.srg FD: net/minecraft/client/Minecraft/framebufferMc net/minecraft/client/Minecraft/field_147124_at
and get
field_147124_at
.
then you have thisScreenShotHelper = Java.type("net.minecraft.util.ScreenShotHelper") function screenShot() { framebufferMcField = mc.class.getDeclaredField("field_147124_at") framebufferMcField.setAccessible(true) framebufferMc = framebufferMcField.get(mc) //with Core.lib you only need 1 line //framebufferMc = getField(mc, "field_147124_at").get(mc) ScreenShotHelper.saveScreenshot(mc.mcDataDir, mc.displayWidth, mc.displayHeight, framebufferMc); }
-
@commandblock2
Thank you! I'm new, what is the.minecraft/LiquidBounce-1.8 $ grep framebufferMc mcp-stable_22.srg FD: net/minecraft/client/Minecraft/framebufferMc net/minecraft/client/Minecraft/field_147124_at
?
-
@commandblock2 said in How to tell a module is on or off?:
well
what does finding that in the text file have to do with the code that you put after? Do I have to change something in the text file or what?
-
@commandblock2 said in How to tell a module is on or off?:
//with Core.lib you only need 1 line //framebufferMc = getField(mc, "field_147124_at").get(mc)
You can do it even more easily with Core now.
adaptedMc = new Reflector(mc); print(adaptedMc.framebufferMc); adaptedMc.framebufferMc = idk;
and so on
-
@chodeman
What I have been trying to do is to changeScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc)
to js.
Since it is in
net/minecraft/client/Minecraft.java
, the type ofthis
isMinecraft
(akanet.minecraft.client.Minecraft
). And the instance ofMinecraft
is exposed asmc
in scriptAPI.
So we change allthis
tomc
.
ButframebufferMc
is not public so you cannot access it from a script.
So we accessing a private variable using reflection.
However the name offramebufferMc
is notframebufferMc
.
See about obfuscation.
You will have to use the Searge name(field_147124_at
) to access variable and functions.
The filemcp-stable_22.srg
have the mappings from MCP name to Searge name.
The reason you can use MCP name to in normal scriptAPI is because they did this.But with Core.lib you don't have to do that anymore.
@CzechHek
THANK YOU BASED HEK. Don't have to look for srg name anymore.
And that should even solved the problem of using script in development environment, going to try it later. -
@commandblock2 dafuq, thank you!
I did not know what do some fields mean, they do not exist in mappings (1.7-1.12).
I used srg file and now know, what does this field mean