Guest User

Untitled

a guest
Jun 25th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.awt.image.BufferedImage;
  4. import org.lwjgl.opengl.GL11;
  5.  
  6. public class GuiChooseName extends GuiScreen {
  7. private BufferedImage img;
  8. private int imgID = 1000;
  9. public GuiChooseName(EntityGorilla entity)
  10. {
  11. mob=entity;
  12. }
  13.  
  14. private GuiTextField textfield;
  15. public EntityGorilla mob;
  16.  
  17. public void initGui() {
  18. try {
  19. img = ModLoader.loadImage(mc.renderEngine, "/TameCraft/ChooseName.png");
  20. mc.renderEngine.setupTexture(img, imgID);
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. controlList.clear();
  25. controlList.add(new GuiButton(1, width / 2 - 49, height / 2 + 20, 70, 20, "Enter"));
  26. textfield = new GuiTextField(this, fontRenderer, width / 2 - 87, height / 2 - 10, 150, 20, "");
  27. textfield.isFocused = false;
  28. textfield.setMaxStringLength(16);
  29.  
  30. }
  31. protected void actionPerformed(GuiButton guibutton)
  32. {
  33. if(guibutton.id == 1)
  34. {
  35. mob.Name = textfield.getText();
  36. mc.displayGuiScreen(null);
  37. }
  38. }
  39. protected void keyTyped(char c, int i)
  40. {
  41. super.keyTyped(c, i);
  42. textfield.textboxKeyTyped(c, i);
  43. }
  44. protected void mouseClicked(int i, int j, int k)
  45. {
  46. super.mouseClicked(i, j, k);
  47. textfield.mouseClicked(i, j, k);
  48. }
  49. public boolean doesGuiPauseGame()
  50. {
  51. return false;
  52. }
  53. public void onGuiClosed()
  54. {
  55. }
  56. public void drawScreen(int i, int j, float f)
  57. {
  58. drawDefaultBackground();
  59. int k = width / 2 - 100;
  60. int l = height / 2 - 40;
  61. try {
  62. int tempvar = mc.renderEngine.getTexture("/mods/name.png");
  63. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  64. mc.renderEngine.bindTexture(tempvar);
  65. drawTexturedModalRect(k, l, 0, 0, 176, 166);
  66. }
  67. finally {
  68. }
  69. textfield.drawTextBox();
  70. drawCenteredString(fontRenderer, "Enter the Name of your Mob", width / 2 - 10, height / 2 - 35, 0xffffff);
  71. super.drawScreen(i, j, f);
  72. }
  73.  
  74.  
  75. }
Add Comment
Please, Sign In to add comment