Guest User

Untitled

a guest
Jul 5th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.36 KB | None | 0 0
  1. package net.minecraft.client.gui;
  2.  
  3. import java.io.IOException;
  4. import net.minecraft.client.gui.achievement.GuiAchievements;
  5. import net.minecraft.client.gui.achievement.GuiStats;
  6. import net.minecraft.client.multiplayer.WorldClient;
  7. import net.minecraft.client.resources.I18n;
  8. import net.minecraft.realms.RealmsBridge;
  9.  
  10. public class GuiIngameMenu extends GuiScreen
  11. {
  12.     private int field_146445_a;
  13.     private int field_146444_f;
  14.  
  15.     /**
  16.      * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
  17.      * window resizes, the buttonList is cleared beforehand.
  18.      */
  19.     public void initGui()
  20.     {
  21.         this.field_146445_a = 0;
  22.         this.buttonList.clear();
  23.         int i = -16;
  24.         int j = 98;
  25.         this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + i, I18n.format("menu.returnToMenu", new Object[0])));
  26.  
  27.         if (!this.mc.isIntegratedServerRunning())
  28.         {
  29.             ((GuiButton)this.buttonList.get(0)).displayString = I18n.format("menu.disconnect", new Object[0]);
  30.         }
  31.  
  32.         this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0])));
  33.         this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0])));
  34.         GuiButton guibutton;
  35.         this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0])));
  36.         this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0])));
  37.         this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0])));
  38.         guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic();
  39.     }
  40.    
  41.     /**
  42.      * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
  43.      */
  44.    
  45.     protected void actionPerformed(GuiButton button) throws IOException
  46.     {
  47.         switch (button.id)
  48.         {
  49.             case 0:
  50.                 this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
  51.                 break;
  52.  
  53.             case 1:
  54.                 boolean flag = this.mc.isIntegratedServerRunning();
  55.                 boolean flag1 = this.mc.isConnectedToRealms();
  56.                 button.enabled = false;
  57.                 this.mc.theWorld.sendQuittingDisconnectingPacket();
  58.                 this.mc.loadWorld((WorldClient)null);
  59.  
  60.                 if (flag)
  61.                 {
  62.                     this.mc.displayGuiScreen(new GuiMainMenu());
  63.                 }
  64.                 else if (flag1)
  65.                 {
  66.                     RealmsBridge realmsbridge = new RealmsBridge();
  67.                     realmsbridge.switchToRealms(new GuiMainMenu());
  68.                 }
  69.                 else
  70.                 {
  71.                     this.mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
  72.                 }
  73.  
  74.             case 2:
  75.             case 3:
  76.             default:
  77.                 break;
  78.  
  79.             case 4:
  80.                 this.mc.displayGuiScreen((GuiScreen)null);
  81.                 this.mc.setIngameFocus();
  82.                 break;
  83.  
  84.             case 5:
  85.                 this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
  86.                 break;
  87.  
  88.             case 6:
  89.                 this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
  90.                 break;
  91.  
  92.             case 7:
  93.                 this.mc.displayGuiScreen(new GuiShareToLan(this));
  94.         }
  95.     }
  96.  
  97.     /**
  98.      * Called from the main game loop to update the screen.
  99.      */
  100.     public void updateScreen()
  101.     {
  102.         super.updateScreen();
  103.         ++this.field_146444_f;
  104.     }
  105.  
  106.     /**
  107.      * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
  108.      */
  109.     public void drawScreen(int mouseX, int mouseY, float partialTicks)
  110.     {
  111.         this.drawDefaultBackground();
  112.         this.drawCenteredString(this.fontRendererObj, I18n.format("menu.game", new Object[0]), this.width / 2, 40, 16777215);
  113.         super.drawScreen(mouseX, mouseY, partialTicks);
  114.     }
  115. }
Add Comment
Please, Sign In to add comment