mercredi 16 juin 2021

Java reflection - Get values from class instance field

I am trying to create an some cheat for Minecraft. For this I decided to use reflection and agents. At the first stage, a question arose. I have Minecraft.class class. This class has getMinecraft() method that returns the instance of Minecraft. And this instance has player field. From this field, i need to get posX variable. I think I did not explain very clearly, so here is an example code of what I want to do:

final net.minecraft.client.Minecraft mc = net.minecraft.client.Minecraft.getMinecraft();
System.out.println(mc.player.posX);

And now, is it possible to somehow implement this through reflection?





Aucun commentaire:

Enregistrer un commentaire