Replace reflection with getters and access transformers where possible
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user