I am attempting to modify the behavior of GUI Drawing inside the popular game 'Minecraft'. Currently I'm left with two options, rewrite every single GUI in the game or rewrite their superclass. So I'm going to go with the assumption that using reflection and modifying the superclass is going to be a lot easier.
I have this method, which handles drawing buttons and labels to the screen in the compiled GuiScreen.class
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
int k;
for (k = 0; k < this.buttonList.size(); ++k)
{
((GuiButton)this.buttonList.get(k)).drawButton(this.mc, p_73863_1_, p_73863_2_);
}
for (k = 0; k < this.labelList.size(); ++k)
{
((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, p_73863_1_, p_73863_2_);
}
}
I would like to simply add a line in each of the for loops which does
System.out.println("This for loop just run!")
Only for the time being, once I have that down I'm sure I can figure out the rest. I'm already aware of how to use reflection to access private methods and modify non-static/private fields. How would I go about using reflection to either modify or replace a method, in comparison to simply invoking it.
Aucun commentaire:
Enregistrer un commentaire