Advertisement
Guest User

GuiIngameMenu

a guest
Jun 26th, 2016
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. package net.minecraft.client.gui;
  2.  
  3. import java.io.IOException;
  4. import java.util.List;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.client.entity.EntityPlayerSP;
  7. import net.minecraft.client.gui.FontRenderer;
  8. import net.minecraft.client.gui.GuiButton;
  9. import net.minecraft.client.gui.GuiMainMenu;
  10. import net.minecraft.client.gui.GuiMultiplayer;
  11. import net.minecraft.client.gui.GuiOptions;
  12. import net.minecraft.client.gui.GuiScreen;
  13. import net.minecraft.client.gui.GuiShareToLan;
  14. import net.minecraft.client.gui.achievement.GuiAchievements;
  15. import net.minecraft.client.gui.achievement.GuiStats;
  16. import net.minecraft.client.multiplayer.WorldClient;
  17. import net.minecraft.client.resources.I18n;
  18. import net.minecraft.client.settings.GameSettings;
  19. import net.minecraft.realms.RealmsBridge;
  20. import net.minecraft.server.integrated.IntegratedServer;
  21. import net.minecraft.stats.StatisticsManager;
  22.  
  23. public class GuiIngameMenu
  24. extends GuiScreen {
  25. private int saveStep;
  26. private int visibleTime;
  27.  
  28. public void initGui() {
  29. this.saveStep = 0;
  30. this.buttonList.clear();
  31. int i = -16;
  32. int j = 98;
  33. this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + -16, I18n.format((String)"menu.returnToMenu", (Object[])new Object[0])));
  34. if (!this.mc.isIntegratedServerRunning()) {
  35. ((GuiButton)this.butonList.get((int)0)).displayString = I18n.format((String)"menu.disconnect", (Object[])new Object[0]);
  36. }
  37. this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + -16, I18n.format((String)"menu.returnToGame", (Object[])new Object[0])));
  38. this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + -16, 98, 20, I18n.format((String)"menu.options", (Object[])new Object[0])));
  39. GuiButton guibutton = this.func_189646_b(new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + -16, 98, 20, I18n.format((String)"menu.shareToLan", (Object[])new Object[0])));
  40. guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic();
  41. this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + -16, 98, 20, I18n.format((String)"gui.achievements", (Object[])new Object[0])));
  42. this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + -16, 98, 20, I18n.format((String)"gui.stats", (Object[])new Object[0])));
  43. }
  44.  
  45. protected void actionPerformed(GuiButton button) throws IOException {
  46. switch (button.id) {
  47. case 0: {
  48. this.mc.displayGuiScreen((GuiScreen)new GuiOptions((GuiScreen)this, this.mc.gameSettings));
  49. break;
  50. }
  51. case 1: {
  52. boolean flag = this.mc.isIntegratedServerRunning();
  53. boolean flag1 = this.mc.isConnectedToRealms();
  54. button.enabled = false;
  55.  
  56. // this.mc.theWorld.sendQuittingDisconnectingPacket();
  57.  
  58.  
  59. this.mc.loadWorld((WorldClient)null);
  60. if (flag) {
  61. this.mc.displayGuiScreen((GuiScreen)new GuiMainMenu());
  62. break;
  63. }
  64. if (flag1) {
  65. RealmsBridge realmsbridge = new RealmsBridge();
  66. realmsbridge.switchToRealms((GuiScreen)new GuiMainMenu());
  67. break;
  68. }
  69. this.mc.displayGuiScreen((GuiScreen)new GuiMultiplayer((GuiScreen)new GuiMainMenu()));
  70. }
  71. default: {
  72. break;
  73. }
  74. case 4: {
  75. this.mc.displayGuiScreen((GuiScreen)null);
  76. this.mc.setIngameFocus();
  77. break;
  78. }
  79. case 5: {
  80. this.mc.displayGuiScreen((GuiScreen)new GuiAchievements((GuiScreen)this, this.mc.thePlayer.getStatFileWriter()));
  81. break;
  82. }
  83. case 6: {
  84. this.mc.displayGuiScreen((GuiScreen)new GuiStats((GuiScreen)this, this.mc.thePlayer.getStatFileWriter()));
  85. break;
  86. }
  87. case 7: {
  88. this.mc.displayGuiScreen((GuiScreen)new GuiShareToLan((GuiScreen)this));
  89. }
  90. }
  91. }
  92.  
  93. public void updateScreen() {
  94. super.updateScreen();
  95. ++this.visibleTime;
  96. }
  97.  
  98. public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  99. this.drawDefaultBackground();
  100. this.drawCenteredString(this.fontRendererObj, I18n.format((String)"menu.game", (Object[])new Object[0]), this.width / 2, 40, 16777215);
  101. super.drawScreen(mouseX, mouseY, partialTicks);
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement