Advertisement
Guest User

Untitled

a guest
Aug 21st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. package latric.outcode.seqouia.stuff.altmanager;
  2.  
  3. import java.io.IOException;
  4. import java.util.Random;
  5.  
  6. import javax.swing.JOptionPane;
  7.  
  8. import org.lwjgl.input.Keyboard;
  9.  
  10. import latric.outcode.seqouia.Seqouia;
  11. import latric.outcode.seqouia.ui.components.DarkButton;
  12. import latric.outcode.seqouia.ui.components.GuiPasswordField;
  13. import net.minecraft.client.gui.GuiButton;
  14. import net.minecraft.client.gui.GuiScreen;
  15. import net.minecraft.client.gui.GuiTextField;
  16.  
  17. public final class AltManager
  18. extends GuiScreen
  19. {
  20. private GuiPasswordField password;
  21. private final GuiScreen previousScreen;
  22. private Login thread;
  23. private GuiTextField username;
  24.  
  25. public AltManager(GuiScreen previousScreen)
  26. {
  27. this.previousScreen = previousScreen;
  28. }
  29.  
  30. protected void actionPerformed(GuiButton button)
  31. {
  32. switch (button.id)
  33. {
  34. case 1:
  35. this.mc.displayGuiScreen(this.previousScreen);
  36. break;
  37. case 0:
  38. this.thread = new Login(this.username.getText(), this.password.getText());
  39. this.thread.start();
  40. }
  41. }
  42.  
  43. public void drawScreen(int mouseX, int mouseY, float partialTicks)
  44. {
  45. this.drawDefaultBackground();
  46. this.username.drawTextBox();
  47. this.password.drawTextBox();
  48. drawCenteredString(this.mc.fontRendererObj, "Alt Login", this.width / 2, 78,
  49. -1);
  50. drawCenteredString(this.mc.fontRendererObj, this.thread == null ? "§6Waiting..." :
  51. this.thread.getStatus(), this.width / 2, 88, -1);
  52. if (this.username.getText().isEmpty()) {
  53. drawString(this.mc.fontRendererObj, "Username / E-Mail", this.width / 2 - 96,
  54. 106, -7829368);
  55. }
  56. if (this.password.getText().isEmpty()) {
  57. drawString(this.mc.fontRendererObj, "Password", this.width / 2 - 96, 136,
  58. -7829368);
  59. }
  60.  
  61. super.drawScreen(mouseX, mouseY, partialTicks);
  62. }
  63.  
  64. public void initGui()
  65. {
  66. int var3 = this.height / 4 + 24;
  67. this.buttonList.add(new DarkButton(0, this.width / 2 - 100, var3 + 72 + 12, "Login"));
  68. this.buttonList.add(new DarkButton(1, this.width / 2 - 100, var3 + 72 + 12 + 24,
  69. "Back"));
  70. this.buttonList.add(new DarkButton(888, this.width / 2 - 100, 0, "Random Alt"));
  71. this.username = new GuiTextField(var3, this.mc.fontRendererObj, this.width / 2 - 100, 100, 200,
  72. 20);
  73. this.password = new GuiPasswordField(this.mc.fontRendererObj, this.width / 2 - 100, 130,
  74. 200, 20);
  75. this.username.setFocused(true);
  76. Keyboard.enableRepeatEvents(true);
  77. }
  78.  
  79. protected void keyTyped(char character, int key)
  80. {
  81. try
  82. {
  83. super.keyTyped(character, key);
  84. }
  85. catch (IOException e)
  86. {
  87. e.printStackTrace();
  88. }
  89. if (character == '\t') {
  90. if ((!this.username.isFocused()) && (!this.password.isFocused()))
  91. {
  92. this.username.setFocused(true);
  93. }
  94. else
  95. {
  96. this.username.setFocused(this.password.isFocused());
  97. this.password.setFocused(!this.username.isFocused());
  98. }
  99. }
  100. // if (character == '\r') {
  101. // actionPerformed((GuiButton)this.buttonList.get(0));
  102. // }
  103. this.username.textboxKeyTyped(character, key);
  104. this.password.textboxKeyTyped(character, key);
  105. }
  106.  
  107. protected void mouseClicked(int x, int y, int button)
  108. {
  109. try
  110. {
  111. super.mouseClicked(x, y, button);
  112. }
  113. catch (IOException e)
  114. {
  115. e.printStackTrace();
  116. }
  117. this.username.mouseClicked(x, y, button);
  118. this.password.mouseClicked(x, y, button);
  119. }
  120.  
  121. public void onGuiClosed()
  122. {
  123. Keyboard.enableRepeatEvents(false);
  124. }
  125.  
  126. public void updateScreen()
  127. {
  128. this.username.updateCursorCounter();
  129. this.password.updateCursorCounter();
  130. }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement