GuiMainMenu .java

net.minecraft.client.gui.GuiMainMenu (class): members: minecraftTitleTextures, titlePanoramaPaths, backgroundTexture, openGLWarningLink, buttonResetDemo.

net.minecraft.client.guiclass628 linesclientextends GuiScreen24.2 KB

Implements

API Surface (9)

void updateScreen()
boolean doesGuiPauseGame()
void keyTyped(char typedChar, int keyCode)
void initGui()
void actionPerformed(GuiButton button)
void confirmClicked(boolean result, int id)
void drawScreen(int mouseX, int mouseY, float partialTicks)
void mouseClicked(int mouseX, int mouseY, int mouseButton)
void onGuiClosed()

Fields & Constants (27)

field_175373_f
logger
RANDOM
splashTexts
minecraftTitleTextures
titlePanoramaPaths
field_96138_a
updateCounter
splashText
buttonResetDemo
panoramaTimer
viewportTexture
field_175375_v
threadLock
openGLWarning1
openGLWarning2
openGLWarningLink
field_92024_r
field_92023_s
field_92022_t
field_92021_u
field_92020_v
field_92019_w
backgroundTexture
realmsButton
field_183502_L
field_183503_M

String literals (33)

"texts/splashes.txt"
"textures/gui/title/minecraft.png"
"textures/gui/title/background/panorama_0.png"
"textures/gui/title/background/panorama_1.png"
"textures/gui/title/background/panorama_2.png"
"textures/gui/title/background/panorama_3.png"
"textures/gui/title/background/panorama_4.png"
"textures/gui/title/background/panorama_5.png"
"Please click "
"here"
" for more information."
"missingno"
"title.oldgl1"
"title.oldgl2"
"background"
"Merry X-mas!"
"Happy new year!"
"OOoooOOOoooo! Spooky!"
"menu.options"
"menu.quit"
"menu.singleplayer"
"menu.multiplayer"
"menu.online"
"menu.playdemo"

Full Source

GuiMainMenu.java628 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import com.google.common.collect.Lists;
4
import java.io.BufferedReader;
5
import java.io.IOException;
6
import java.io.InputStreamReader;
7
import java.net.URI;
8
import java.util.Calendar;
9
import java.util.Date;
10
import java.util.List;
11
import java.util.Random;
12
import java.util.concurrent.atomic.AtomicInteger;
13
import net.minecraft.client.Minecraft;
14
import net.minecraft.client.renderer.GlStateManager;
15
import net.minecraft.client.renderer.OpenGlHelper;
16
import net.minecraft.client.renderer.Tessellator;
17
import net.minecraft.client.renderer.WorldRenderer;
18
import net.minecraft.client.renderer.texture.DynamicTexture;
19
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
20
import net.minecraft.client.resources.I18n;
21
import net.minecraft.client.settings.GameSettings;
22
import net.minecraft.realms.RealmsBridge;
23
import net.minecraft.util.EnumChatFormatting;
24
import net.minecraft.util.MathHelper;
25
import net.minecraft.util.ResourceLocation;
26
import net.minecraft.world.demo.DemoWorldServer;
27
import net.minecraft.world.storage.ISaveFormat;
28
import net.minecraft.world.storage.WorldInfo;
29
import org.apache.commons.io.Charsets;
30
import org.apache.logging.log4j.LogManager;
31
import org.apache.logging.log4j.Logger;
32
import org.lwjgl.opengl.GL11;
33
import org.lwjgl.opengl.GLContext;
34
import org.lwjgl.util.glu.Project;
35
36
public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback
37
{
38
    private static final AtomicInteger field_175373_f = new AtomicInteger(0);
39
    private static final Logger logger = LogManager.getLogger();
40
    private static final Random RANDOM = new Random();
41
42
    /** Counts the number of screen updates. */
43
    private float updateCounter;
44
45
    /** The splash message. */
46
    private String splashText;
47
    private GuiButton buttonResetDemo;
48
49
    /** Timer used to rotate the panorama, increases every tick. */
50
    private int panoramaTimer;
51
52
    /**
53
     * Texture allocated for the current viewport of the main menu's panorama background.
54
     */
55
    private DynamicTexture viewportTexture;
56
    private boolean field_175375_v = true;
57
58
    /**
59
     * The Object object utilized as a thread lock when performing non thread-safe operations
60
     */
61
    private final Object threadLock = new Object();
62
63
    /** OpenGL graphics card warning. */
64
    private String openGLWarning1;
65
66
    /** OpenGL graphics card warning. */
67
    private String openGLWarning2;
68
69
    /** Link to the Mojang Support about minimum requirements */
70
    private String openGLWarningLink;
71
    private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt");
72
    private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png");
73
74
    /** An array of all the paths to the panorama pictures. */
75
    private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("textures/gui/title/background/panorama_0.png"), new ResourceLocation("textures/gui/title/background/panorama_1.png"), new ResourceLocation("textures/gui/title/background/panorama_2.png"), new ResourceLocation("textures/gui/title/background/panorama_3.png"), new ResourceLocation("textures/gui/title/background/panorama_4.png"), new ResourceLocation("textures/gui/title/background/panorama_5.png")};
76
    public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information.";
77
    private int field_92024_r;
78
    private int field_92023_s;
79
    private int field_92022_t;
80
    private int field_92021_u;
81
    private int field_92020_v;
82
    private int field_92019_w;
83
    private ResourceLocation backgroundTexture;
84
85
    /** Minecraft Realms button. */
86
    private GuiButton realmsButton;
87
    private boolean field_183502_L;
88
    private GuiScreen field_183503_M;
89
90
    public GuiMainMenu()
91
    {
92
        this.openGLWarning2 = field_96138_a;
93
        this.field_183502_L = false;
94
        this.splashText = "missingno";
95
        BufferedReader bufferedreader = null;
96
97
        try
98
        {
99
            List<String> list = Lists.<String>newArrayList();
100
            bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8));
101
            String s;
102
103
            while ((s = bufferedreader.readLine()) != null)
104
            {
105
                s = s.trim();
106
107
                if (!s.isEmpty())
108
                {
109
                    list.add(s);
110
                }
111
            }
112
113
            if (!list.isEmpty())
114
            {
115
                while (true)
116
                {
117
                    this.splashText = (String)list.get(RANDOM.nextInt(list.size()));
118
119
                    if (this.splashText.hashCode() != 125780783)
120
                    {
121
                        break;
122
                    }
123
                }
124
            }
125
        }
126
        catch (IOException var12)
127
        {
128
            ;
129
        }
130
        finally
131
        {
132
            if (bufferedreader != null)
133
            {
134
                try
135
                {
136
                    bufferedreader.close();
137
                }
138
                catch (IOException var11)
139
                {
140
                    ;
141
                }
142
            }
143
        }
144
145
        this.updateCounter = RANDOM.nextFloat();
146
        this.openGLWarning1 = "";
147
148
        if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported())
149
        {
150
            this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]);
151
            this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]);
152
            this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
153
        }
154
    }
155
156
    private boolean func_183501_a()
157
    {
158
        return Minecraft.getMinecraft().gameSettings.getOptionOrdinalValue(GameSettings.Options.REALMS_NOTIFICATIONS) && this.field_183503_M != null;
159
    }
160
161
    /**
162
     * Called from the main game loop to update the screen.
163
     */
164
    public void updateScreen()
165
    {
166
        ++this.panoramaTimer;
167
168
        if (this.func_183501_a())
169
        {
170
            this.field_183503_M.updateScreen();
171
        }
172
    }
173
174
    /**
175
     * Returns true if this GUI should pause the game when it is displayed in single-player
176
     */
177
    public boolean doesGuiPauseGame()
178
    {
179
        return false;
180
    }
181
182
    /**
183
     * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
184
     * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
185
     */
186
    protected void keyTyped(char typedChar, int keyCode) throws IOException
187
    {
188
    }
189
190
    /**
191
     * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
192
     * window resizes, the buttonList is cleared beforehand.
193
     */
194
    public void initGui()
195
    {
196
        this.viewportTexture = new DynamicTexture(256, 256);
197
        this.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
198
        Calendar calendar = Calendar.getInstance();
199
        calendar.setTime(new Date());
200
201
        if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24)
202
        {
203
            this.splashText = "Merry X-mas!";
204
        }
205
        else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1)
206
        {
207
            this.splashText = "Happy new year!";
208
        }
209
        else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31)
210
        {
211
            this.splashText = "OOoooOOOoooo! Spooky!";
212
        }
213
214
        int i = 24;
215
        int j = this.height / 4 + 48;
216
217
        if (this.mc.isDemo())
218
        {
219
            this.addDemoButtons(j, 24);
220
        }
221
        else
222
        {
223
            this.addSingleplayerMultiplayerButtons(j, 24);
224
        }
225
226
        this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format("menu.options", new Object[0])));
227
        this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format("menu.quit", new Object[0])));
228
        this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 72 + 12));
229
230
        synchronized (this.threadLock)
231
        {
232
            this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1);
233
            this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2);
234
            int k = Math.max(this.field_92023_s, this.field_92024_r);
235
            this.field_92022_t = (this.width - k) / 2;
236
            this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
237
            this.field_92020_v = this.field_92022_t + k;
238
            this.field_92019_w = this.field_92021_u + 24;
239
        }
240
241
        this.mc.setConnectedToRealms(false);
242
243
        if (Minecraft.getMinecraft().gameSettings.getOptionOrdinalValue(GameSettings.Options.REALMS_NOTIFICATIONS) && !this.field_183502_L)
244
        {
245
            RealmsBridge realmsbridge = new RealmsBridge();
246
            this.field_183503_M = realmsbridge.getNotificationScreen(this);
247
            this.field_183502_L = true;
248
        }
249
250
        if (this.func_183501_a())
251
        {
252
            this.field_183503_M.setGuiSize(this.width, this.height);
253
            this.field_183503_M.initGui();
254
        }
255
    }
256
257
    /**
258
     * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
259
     */
260
    private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_)
261
    {
262
        this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0])));
263
        this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0])));
264
        this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0])));
265
    }
266
267
    /**
268
     * Adds Demo buttons on Main Menu for players who are playing Demo.
269
     */
270
    private void addDemoButtons(int p_73972_1_, int p_73972_2_)
271
    {
272
        this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
273
        this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
274
        ISaveFormat isaveformat = this.mc.getSaveLoader();
275
        WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
276
277
        if (worldinfo == null)
278
        {
279
            this.buttonResetDemo.enabled = false;
280
        }
281
    }
282
283
    /**
284
     * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
285
     */
286
    protected void actionPerformed(GuiButton button) throws IOException
287
    {
288
        if (button.id == 0)
289
        {
290
            this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
291
        }
292
293
        if (button.id == 5)
294
        {
295
            this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
296
        }
297
298
        if (button.id == 1)
299
        {
300
            this.mc.displayGuiScreen(new GuiSelectWorld(this));
301
        }
302
303
        if (button.id == 2)
304
        {
305
            this.mc.displayGuiScreen(new GuiMultiplayer(this));
306
        }
307
308
        if (button.id == 14 && this.realmsButton.visible)
309
        {
310
            this.switchToRealms();
311
        }
312
313
        if (button.id == 4)
314
        {
315
            this.mc.shutdown();
316
        }
317
318
        if (button.id == 11)
319
        {
320
            this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
321
        }
322
323
        if (button.id == 12)
324
        {
325
            ISaveFormat isaveformat = this.mc.getSaveLoader();
326
            WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
327
328
            if (worldinfo != null)
329
            {
330
                GuiYesNo guiyesno = GuiSelectWorld.makeDeleteWorldYesNo(this, worldinfo.getWorldName(), 12);
331
                this.mc.displayGuiScreen(guiyesno);
332
            }
333
        }
334
    }
335
336
    private void switchToRealms()
337
    {
338
        RealmsBridge realmsbridge = new RealmsBridge();
339
        realmsbridge.switchToRealms(this);
340
    }
341
342
    public void confirmClicked(boolean result, int id)
343
    {
344
        if (result && id == 12)
345
        {
346
            ISaveFormat isaveformat = this.mc.getSaveLoader();
347
            isaveformat.flushCache();
348
            isaveformat.deleteWorldDirectory("Demo_World");
349
            this.mc.displayGuiScreen(this);
350
        }
351
        else if (id == 13)
352
        {
353
            if (result)
354
            {
355
                try
356
                {
357
                    Class<?> oclass = Class.forName("java.awt.Desktop");
358
                    Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
359
                    oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(this.openGLWarningLink)});
360
                }
361
                catch (Throwable throwable)
362
                {
363
                    logger.error("Couldn\'t open link", throwable);
364
                }
365
            }
366
367
            this.mc.displayGuiScreen(this);
368
        }
369
    }
370
371
    /**
372
     * Draws the main menu panorama
373
     */
374
    private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_)
375
    {
376
        Tessellator tessellator = Tessellator.getInstance();
377
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
378
        GlStateManager.matrixMode(5889);
379
        GlStateManager.pushMatrix();
380
        GlStateManager.loadIdentity();
381
        Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
382
        GlStateManager.matrixMode(5888);
383
        GlStateManager.pushMatrix();
384
        GlStateManager.loadIdentity();
385
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
386
        GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
387
        GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
388
        GlStateManager.enableBlend();
389
        GlStateManager.disableAlpha();
390
        GlStateManager.disableCull();
391
        GlStateManager.depthMask(false);
392
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
393
        int i = 8;
394
395
        for (int j = 0; j < i * i; ++j)
396
        {
397
            GlStateManager.pushMatrix();
398
            float f = ((float)(j % i) / (float)i - 0.5F) / 64.0F;
399
            float f1 = ((float)(j / i) / (float)i - 0.5F) / 64.0F;
400
            float f2 = 0.0F;
401
            GlStateManager.translate(f, f1, f2);
402
            GlStateManager.rotate(MathHelper.sin(((float)this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
403
            GlStateManager.rotate(-((float)this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F);
404
405
            for (int k = 0; k < 6; ++k)
406
            {
407
                GlStateManager.pushMatrix();
408
409
                if (k == 1)
410
                {
411
                    GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
412
                }
413
414
                if (k == 2)
415
                {
416
                    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
417
                }
418
419
                if (k == 3)
420
                {
421
                    GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
422
                }
423
424
                if (k == 4)
425
                {
426
                    GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
427
                }
428
429
                if (k == 5)
430
                {
431
                    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
432
                }
433
434
                this.mc.getTextureManager().bindTexture(titlePanoramaPaths[k]);
435
                worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
436
                int l = 255 / (j + 1);
437
                float f3 = 0.0F;
438
                worldrenderer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex();
439
                worldrenderer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex();
440
                worldrenderer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex();
441
                worldrenderer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex();
442
                tessellator.draw();
443
                GlStateManager.popMatrix();
444
            }
445
446
            GlStateManager.popMatrix();
447
            GlStateManager.colorMask(true, true, true, false);
448
        }
449
450
        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
451
        GlStateManager.colorMask(true, true, true, true);
452
        GlStateManager.matrixMode(5889);
453
        GlStateManager.popMatrix();
454
        GlStateManager.matrixMode(5888);
455
        GlStateManager.popMatrix();
456
        GlStateManager.depthMask(true);
457
        GlStateManager.enableCull();
458
        GlStateManager.enableDepth();
459
    }
460
461
    /**
462
     * Rotate and blurs the skybox view in the main menu
463
     */
464
    private void rotateAndBlurSkybox(float p_73968_1_)
465
    {
466
        this.mc.getTextureManager().bindTexture(this.backgroundTexture);
467
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
468
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
469
        GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
470
        GlStateManager.enableBlend();
471
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
472
        GlStateManager.colorMask(true, true, true, false);
473
        Tessellator tessellator = Tessellator.getInstance();
474
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
475
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
476
        GlStateManager.disableAlpha();
477
        int i = 3;
478
479
        for (int j = 0; j < i; ++j)
480
        {
481
            float f = 1.0F / (float)(j + 1);
482
            int k = this.width;
483
            int l = this.height;
484
            float f1 = (float)(j - i / 2) / 256.0F;
485
            worldrenderer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
486
            worldrenderer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
487
            worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
488
            worldrenderer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
489
        }
490
491
        tessellator.draw();
492
        GlStateManager.enableAlpha();
493
        GlStateManager.colorMask(true, true, true, true);
494
    }
495
496
    /**
497
     * Renders the skybox in the main menu
498
     */
499
    private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_)
500
    {
501
        this.mc.getFramebuffer().unbindFramebuffer();
502
        GlStateManager.viewport(0, 0, 256, 256);
503
        this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_);
504
        this.rotateAndBlurSkybox(p_73971_3_);
505
        this.rotateAndBlurSkybox(p_73971_3_);
506
        this.rotateAndBlurSkybox(p_73971_3_);
507
        this.rotateAndBlurSkybox(p_73971_3_);
508
        this.rotateAndBlurSkybox(p_73971_3_);
509
        this.rotateAndBlurSkybox(p_73971_3_);
510
        this.rotateAndBlurSkybox(p_73971_3_);
511
        this.mc.getFramebuffer().bindFramebuffer(true);
512
        GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
513
        float f = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height;
514
        float f1 = (float)this.height * f / 256.0F;
515
        float f2 = (float)this.width * f / 256.0F;
516
        int i = this.width;
517
        int j = this.height;
518
        Tessellator tessellator = Tessellator.getInstance();
519
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
520
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
521
        worldrenderer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
522
        worldrenderer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
523
        worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
524
        worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
525
        tessellator.draw();
526
    }
527
528
    /**
529
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
530
     */
531
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
532
    {
533
        GlStateManager.disableAlpha();
534
        this.renderSkybox(mouseX, mouseY, partialTicks);
535
        GlStateManager.enableAlpha();
536
        Tessellator tessellator = Tessellator.getInstance();
537
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
538
        int i = 274;
539
        int j = this.width / 2 - i / 2;
540
        int k = 30;
541
        this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
542
        this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
543
        this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
544
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
545
546
        if ((double)this.updateCounter < 1.0E-4D)
547
        {
548
            this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 99, 44);
549
            this.drawTexturedModalRect(j + 99, k + 0, 129, 0, 27, 44);
550
            this.drawTexturedModalRect(j + 99 + 26, k + 0, 126, 0, 3, 44);
551
            this.drawTexturedModalRect(j + 99 + 26 + 3, k + 0, 99, 0, 26, 44);
552
            this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
553
        }
554
        else
555
        {
556
            this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 155, 44);
557
            this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
558
        }
559
560
        GlStateManager.pushMatrix();
561
        GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
562
        GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
563
        float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
564
        f = f * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
565
        GlStateManager.scale(f, f, f);
566
        this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
567
        GlStateManager.popMatrix();
568
        String s = "Minecraft 1.8.9";
569
570
        if (this.mc.isDemo())
571
        {
572
            s = s + " Demo";
573
        }
574
575
        this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1);
576
        String s1 = "Copyright Mojang AB. Do not distribute!";
577
        this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);
578
579
        if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0)
580
        {
581
            drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
582
            this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
583
            this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
584
        }
585
586
        super.drawScreen(mouseX, mouseY, partialTicks);
587
588
        if (this.func_183501_a())
589
        {
590
            this.field_183503_M.drawScreen(mouseX, mouseY, partialTicks);
591
        }
592
    }
593
594
    /**
595
     * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
596
     */
597
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
598
    {
599
        super.mouseClicked(mouseX, mouseY, mouseButton);
600
601
        synchronized (this.threadLock)
602
        {
603
            if (this.openGLWarning1.length() > 0 && mouseX >= this.field_92022_t && mouseX <= this.field_92020_v && mouseY >= this.field_92021_u && mouseY <= this.field_92019_w)
604
            {
605
                GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true);
606
                guiconfirmopenlink.disableSecurityWarning();
607
                this.mc.displayGuiScreen(guiconfirmopenlink);
608
            }
609
        }
610
611
        if (this.func_183501_a())
612
        {
613
            this.field_183503_M.mouseClicked(mouseX, mouseY, mouseButton);
614
        }
615
    }
616
617
    /**
618
     * Called when the screen is unloaded. Used to disable keyboard repeat events
619
     */
620
    public void onGuiClosed()
621
    {
622
        if (this.field_183503_M != null)
623
        {
624
            this.field_183503_M.onGuiClosed();
625
        }
626
    }
627
}
628

Deobfuscated MCP 1.8.9 source of GuiMainMenu from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/gui/GuiMainMenu.java), stored verbatim.