Replace reflection with getters and access transformers where possible

This commit is contained in:
johni0702
2015-05-05 14:08:44 +02:00
parent aeb8f5c0cb
commit 20625b7180
10 changed files with 105 additions and 336 deletions

View File

@@ -1,24 +1,10 @@
package eu.crushedpixel.replaymod.gui;
import eu.crushedpixel.replaymod.reflection.MCPNames;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import java.lang.reflect.Field;
public class PasswordTextField extends GuiTextField {
private static Field text;
static {
try {
text = GuiTextField.class.getDeclaredField(MCPNames.field("field_146216_j"));
text.setAccessible(true);
} catch(Exception e) {
e.printStackTrace();
}
}
public PasswordTextField(int p_i45542_1_, FontRenderer p_i45542_2_,
int p_i45542_3_, int p_i45542_4_, int p_i45542_5_, int p_i45542_6_) {
super(p_i45542_1_, p_i45542_2_, p_i45542_3_, p_i45542_4_, p_i45542_5_,
@@ -34,12 +20,9 @@ public class PasswordTextField extends GuiTextField {
pw += "*";
}
try {
text.set(this, pw);
super.drawTextBox();
text.set(this, prev);
} catch(Exception e) {
}
text = pw;
super.drawTextBox();
text = prev;
}