Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.79 KB | None | 0 0
  1. package me.underlp.client.gui;
  2.  
  3. import java.awt.Desktop;
  4. import java.io.BufferedReader;
  5. import java.io.IOException;
  6. import java.net.URL;
  7. import java.util.Calendar;
  8. import java.util.Date;
  9. import java.util.concurrent.atomic.AtomicInteger;
  10.  
  11. import org.apache.logging.log4j.LogManager;
  12. import org.apache.logging.log4j.Logger;
  13. import org.lwjgl.opengl.GL11;
  14. import org.lwjgl.opengl.GLContext;
  15.  
  16. import me.underlp.client.design.DarkButton;
  17. import me.underlp.client.main.Blend;
  18. import net.minecraft.client.Minecraft;
  19. import net.minecraft.client.gui.Gui;
  20. import net.minecraft.client.gui.GuiButton;
  21. import net.minecraft.client.gui.GuiButtonLanguage;
  22. import net.minecraft.client.gui.GuiLanguage;
  23. import net.minecraft.client.gui.GuiMultiplayer;
  24. import net.minecraft.client.gui.GuiOptions;
  25. import net.minecraft.client.gui.GuiScreen;
  26. import net.minecraft.client.gui.GuiSelectWorld;
  27. import net.minecraft.client.gui.GuiYesNoCallback;
  28. import net.minecraft.client.gui.ScaledResolution;
  29. import net.minecraft.client.renderer.GlStateManager;
  30. import net.minecraft.client.renderer.OpenGlHelper;
  31. import net.minecraft.client.renderer.Tessellator;
  32. import net.minecraft.client.renderer.WorldRenderer;
  33. import net.minecraft.client.renderer.texture.DynamicTexture;
  34. import net.minecraft.client.resources.I18n;
  35. import net.minecraft.realms.RealmsBridge;
  36. import net.minecraft.util.EnumChatFormatting;
  37. import net.minecraft.util.MathHelper;
  38. import net.minecraft.util.ResourceLocation;
  39.  
  40. public class GuiMeMainMenu extends GuiScreen implements GuiYesNoCallback{
  41.  
  42.    
  43.      private static final AtomicInteger field_175373_f = new AtomicInteger(0);
  44.         private static final Logger logger = LogManager.getLogger();
  45.  
  46.         private DarkButton buttonResetDemo;
  47.  
  48.         private DynamicTexture viewportTexture;
  49.         private boolean field_175375_v = true;
  50.  
  51.         private final Object threadLock = new Object();
  52.  
  53.         private String openGLWarning1;
  54.  
  55.         private String openGLWarning2;
  56.  
  57.         private String openGLWarningLink;
  58.  
  59.         public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information.";
  60.         private int field_92024_r;
  61.         private int field_92023_s;
  62.         private int field_92022_t;
  63.         private int field_92021_u;
  64.         private int field_92020_v;
  65.         private int field_92019_w;
  66.  
  67.         private DarkButton realmsButton;
  68.        
  69.         public GuiMeMainMenu()
  70.         {
  71.             this.openGLWarning2 = field_96138_a;
  72.             BufferedReader bufferedreader = null;
  73.  
  74.             this.openGLWarning1 = "";
  75.  
  76.             if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported())
  77.             {
  78.                 this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]);
  79.                 this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]);
  80.                 this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
  81.             }
  82.         }
  83.  
  84.         public boolean doesGuiPauseGame()
  85.         {
  86.             return false;
  87.         }
  88.  
  89.         protected void keyTyped(char typedChar, int keyCode) throws IOException
  90.         {
  91.         }
  92.  
  93.         public void initGui()
  94.         {
  95.             this.viewportTexture = new DynamicTexture(256, 256);
  96.             Calendar calendar = Calendar.getInstance();
  97.             calendar.setTime(new Date());
  98.  
  99.             int i = 24;
  100.             int j = this.height / 4 + 48;
  101.  
  102.             if (this.mc.isDemo())
  103.             {
  104.             }
  105.             else
  106.             {
  107.                 this.addSingleplayerMultiplayerButtons(j, 24);
  108.             }
  109.  
  110.             this.buttonList.add(new DarkButton(0, this.width / 1 - 580, j + 100 + 0, 98, 20, I18n.format("menu.options", new Object[0])));
  111.             this.buttonList.add(new DarkButton(4, this.width / 1 - 478, j + 100 + 0, 98, 20, I18n.format("menu.quit", new Object[0])));
  112.             this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 100 + 0));
  113.  
  114.             synchronized (this.threadLock)
  115.             {
  116.                 this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1);
  117.                 this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2);
  118.                 int k = Math.max(this.field_92023_s, this.field_92024_r);
  119.                 this.field_92022_t = (this.width - k) / 2;
  120.                 this.field_92021_u = ((DarkButton)this.buttonList.get(0)).yPosition - 24;
  121.                 this.field_92020_v = this.field_92022_t + k;
  122.                 this.field_92019_w = this.field_92021_u + 24;
  123.             }
  124.         }
  125.  
  126.         private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_)
  127.         {
  128.             this.buttonList.add(new DarkButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0])));
  129.             this.buttonList.add(new DarkButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0])));
  130.             this.buttonList.add(this.realmsButton = new DarkButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, "Changelog"));
  131.             this.buttonList.add(this.realmsButton = new DarkButton(11, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 3, "YouTube"));
  132.         }
  133.  
  134.         protected void actionPerformed(GuiButton button) throws IOException
  135.         {
  136.             if (button.id == 0)
  137.             {
  138.                 this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
  139.             }
  140.  
  141.             if (button.id == 5)
  142.             {
  143.                 this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
  144.             }
  145.  
  146.             if (button.id == 1)
  147.             {
  148.                 this.mc.displayGuiScreen(new GuiSelectWorld(this));
  149.             }
  150.  
  151.             if (button.id == 2)
  152.             {
  153.                 this.mc.displayGuiScreen(new GuiMultiplayer(this));
  154.             }
  155.            
  156.             if(button.id == 14)
  157.             {
  158.                 this.mc.displayGuiScreen(new GuiChangelog());
  159.             }
  160.            
  161.             if(button.id == 11)
  162.             {
  163.                 Blend.openWebpage();
  164.             }
  165.          
  166.              
  167.             if (button.id == 4)
  168.             {
  169.                 this.mc.shutdown();
  170.             }
  171.         }
  172.  
  173.         private void switchToRealms()
  174.         {
  175.             RealmsBridge realmsbridge = new RealmsBridge();
  176.             realmsbridge.switchToRealms(this);
  177.         }
  178.  
  179.         public void drawScreen(int mouseX, int mouseY, float partialTicks)
  180.         {
  181.             GlStateManager.disableAlpha();
  182.             GlStateManager.enableAlpha();
  183.             Tessellator tessellator = Tessellator.getInstance();
  184.             WorldRenderer worldrenderer = tessellator.getWorldRenderer();
  185.             int i = 274;
  186.             int j = this.width / 2 - i / 2;
  187.             int k = 30;
  188.             this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
  189.             this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
  190.             GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  191.            
  192.             ScaledResolution scaledRes = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
  193.             this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/blend/bg1.jpg"));
  194.             Gui.drawScaledCustomSizeModalRect(0, 0, 0.0F, 0.0F, scaledRes.getScaledWidth(), scaledRes.getScaledHeight(), scaledRes.getScaledWidth(), scaledRes.getScaledHeight(), scaledRes.getScaledWidth(), scaledRes.getScaledHeight());
  195.            
  196.  
  197.             GlStateManager.pushMatrix();
  198.             GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
  199.             GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
  200.             float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
  201.             GlStateManager.scale(f, f, f);
  202.             GlStateManager.popMatrix();
  203.             String s = "§aBlend §BB1";
  204.  
  205.             this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1);
  206.             String s1 = "§7by UnderLP";
  207.             this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);
  208.            
  209.             float scale = 5.0F;
  210.             GL11.glScalef(scale, scale, scale);
  211.             drawString(this.fontRendererObj, "§a  Blend", this.width / 2 / scale - 22.4F, this.height / 5 / scale - 0.0F, 16777215);
  212.             GL11.glScalef(1.0F / scale, 1.0F / scale, 1.0F / scale);
  213.  
  214.             if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0)
  215.             {
  216.                 drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
  217.                 this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
  218.                 this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
  219.             }
  220.  
  221.             super.drawScreen(mouseX, mouseY, partialTicks);
  222.         }
  223.  
  224.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement