Refactored and reformatted code to use less static variables

This commit is contained in:
CrushedPixel
2015-04-23 14:09:54 +02:00
parent f22416be2c
commit 0003f040ed
109 changed files with 9037 additions and 10229 deletions

View File

@@ -1,46 +1,46 @@
package eu.crushedpixel.replaymod.gui;
import java.lang.reflect.Field;
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;
private static Field text;
static {
try {
text = GuiTextField.class.getDeclaredField(MCPNames.field("field_146216_j"));
text.setAccessible(true);
} catch(Exception e) {
e.printStackTrace();
}
}
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_,
p_i45542_6_);
}
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_,
p_i45542_6_);
}
@Override
public void drawTextBox() {
String prev = getText();
@Override
public void drawTextBox() {
String prev = getText();
String pw = "";
for(int i=0; i<prev.length(); i++) {
pw += "*";
}
try {
text.set(this, pw);
super.drawTextBox();
text.set(this, prev);
} catch(Exception e) {}
}
String pw = "";
for(int i = 0; i < prev.length(); i++) {
pw += "*";
}
try {
text.set(this, pw);
super.drawTextBox();
text.set(this, prev);
} catch(Exception e) {
}
}
}