Hello, so recently I've got an idea to create a simple autoclicker in Minecraft, when I've discovered JNI. Java Native Interface (JNI) is a C++ framework from Java enables code inside a JVM (java virtual machine) to be called from for example C++.
So I've found C++ code for a simple C++ program that would attach to Minecraft Forge JVM(because original Minecraft is obfuscated and I've chose Forge) using JNI, get the Forge class loader if I understand it correctly and then use a method from it to get the Minecraft class. Here's what it does (this should be right):
1. It finds the class net.minecraft.launchwrapper.LaunchClassLoader
2. It gets the static field (it's an object that's a class) classLoader from it.
3. It executes a method in the classLoader called findClas with the parameters of the Minecraft class name (net.minecraft.client.Minecraft).
This code is working correctly as intended, it successfully returns the Minecraft class. However when I try to get the method getMinecraft from the class it says that the method is null (it probably doesn't exist). I'm 100% sure that the C++ code is working correctly but for some reason it can't find the method in the class. I've also tried getting the theMinecraft static field (which should be the instance of Minecraft class) from the Minecraft class, but that is null also. Do you guys know what is wrong here? Also, if you want I can post the C++ code but I'm 100% sure it's correct.
EDIT:
The reason why this was not working is because THE CLASS WAS REOBFUSCATED!
Best Regards - Martin.