Advertisement
Guest User

Untitled

a guest
Jul 15th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.45 KB | None | 0 0
  1. package fr.ph1823.RoylityCraft.Menu;
  2.  
  3. import java.awt.Desktop;
  4. import java.io.BufferedReader;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.net.URI;
  8. import java.util.ArrayList;
  9. import java.util.Calendar;
  10. import java.util.Date;
  11. import java.util.List;
  12. import java.util.Random;
  13. import java.util.logging.LogManager;
  14. import java.util.logging.Logger;
  15.  
  16. import fr.ph1823.RoylityCraft.Menu.CustomButton;
  17. import net.minecraft.client.Minecraft;
  18. import net.minecraft.client.gui.GuiButton;
  19. import net.minecraft.client.gui.GuiButtonLanguage;
  20. import net.minecraft.client.gui.GuiConfirmOpenLink;
  21. import net.minecraft.client.gui.GuiLanguage;
  22. import net.minecraft.client.gui.GuiMultiplayer;
  23. import net.minecraft.client.gui.GuiOptions;
  24. import net.minecraft.client.gui.GuiScreen;
  25. import net.minecraft.client.gui.GuiSelectWorld;
  26. import net.minecraft.client.gui.GuiYesNo;
  27.  
  28. import net.minecraft.client.renderer.OpenGlHelper;
  29. import net.minecraft.client.renderer.Tessellator;
  30. import net.minecraft.client.renderer.texture.DynamicTexture;
  31. import net.minecraft.client.resources.I18n;
  32. import net.minecraft.util.EnumChatFormatting;
  33. import net.minecraft.util.MathHelper;
  34. import net.minecraft.util.ResourceLocation;
  35. import net.minecraft.world.demo.DemoWorldServer;
  36. import net.minecraft.world.storage.ISaveFormat;
  37. import net.minecraft.world.storage.WorldInfo;
  38.  
  39. import org.apache.commons.io.Charsets;
  40.  
  41. import org.lwjgl.opengl.GL11;
  42. import org.lwjgl.opengl.GLContext;
  43. import org.lwjgl.util.glu.Project;
  44.  
  45. import com.google.common.base.Strings;
  46. import com.google.common.collect.Lists;
  47.  
  48. import cpw.mods.fml.client.FMLClientHandler;
  49. import cpw.mods.fml.client.GuiModList;
  50. import cpw.mods.fml.common.FMLCommonHandler;
  51. import cpw.mods.fml.relauncher.Side;
  52. import cpw.mods.fml.relauncher.SideOnly;
  53. import fr.ph1823.RoylityCraft.RoylityCraft;
  54.  
  55. @SideOnly(Side.CLIENT)
  56. public class CustomMainMenu extends GuiScreen implements GuiYesNoCallback
  57. {    
  58.    private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("Minecraft");
  59.    /** The RNG used by the Main Menu Screen. */
  60.    private static final Random rand = new Random();
  61.    /** Counts the number of screen updates. */
  62.    private float updateCounter;
  63.    /** The splash message. */
  64.    private String splashText;
  65.    private GuiButton buttonResetDemo;
  66.    /** Timer used to rotate the panorama, increases every tick. */
  67.    private int panoramaTimer;
  68.    /**
  69.     * Texture allocated for the current viewport of the main menu's panorama background.
  70.     */
  71.    private DynamicTexture viewportTexture;
  72.    private final Object field_104025_t = new Object();
  73.    private String field_92025_p;
  74.    private String field_146972_A;
  75.    private String field_104024_v;
  76.    private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt");
  77.    private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png");
  78.    /** An array of all the paths to the panorama pictures. */
  79.    private static final ResourceLocation titlePanoramaPaths = new ResourceLocation("guicustom","textures/b.png");  public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information.";
  80.    private int field_92024_r;
  81.    private int field_92023_s;
  82.    private int field_92022_t;
  83.    private int field_92021_u;
  84.    private int field_92020_v;
  85.    private int field_92019_w;
  86.    private ResourceLocation field_110351_G;
  87.    
  88.    private OldServerPinger pinger = new OldServerPinger();
  89.  
  90.  
  91.    public CustomMainMenu()
  92.    {
  93.        this.field_146972_A = field_96138_a;
  94.        this.splashText = "missingno";
  95.        BufferedReader bufferedreader = null;
  96.        try
  97.        {
  98.            ArrayList arraylist = new ArrayList();
  99.            bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8));
  100.            String s;
  101.  
  102.            while((s = bufferedreader.readLine()) != null)
  103.            {
  104.              
  105.                s = s.trim();
  106.  
  107.                if(!s.isEmpty())
  108.                {
  109.                    arraylist.add(s);
  110.                }
  111.            }
  112.  
  113.            if(!arraylist.isEmpty())
  114.            {
  115.                do
  116.                {
  117.                    this.splashText = (String)arraylist.get(rand.nextInt(arraylist.size()));
  118.                }
  119.                while(this.splashText.hashCode() == 125780783);
  120.            }
  121.        }
  122.        catch(IOException ioexception1)
  123.        {
  124.            ;
  125.        }
  126.        finally
  127.        {
  128.            if(bufferedreader != null)
  129.            {
  130.                try
  131.                {
  132.                    bufferedreader.close();
  133.                }
  134.                catch(IOException ioexception)
  135.                {
  136.  
  137.                }
  138.            }
  139.        }
  140.  
  141.        this.updateCounter = rand.nextFloat();
  142.        this.field_92025_p = "";
  143.  
  144.        if(!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.func_153193_b())
  145.        {
  146.            this.field_92025_p = I18n.format("title.oldgl1", new Object[0]);
  147.            this.field_146972_A = I18n.format("title.oldgl2", new Object[0]);
  148.            this.field_104024_v = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
  149.        }
  150.    }
  151.  
  152.    /**
  153.     * Called from the main game loop to update the screen.
  154.     */
  155.    public void updateScreen()
  156.    {
  157.        ++this.panoramaTimer;
  158.        this.pinger.func_147223_a();
  159.    }
  160.  
  161.    public void onGuiClosed()
  162.    {
  163.        this.pinger.func_147226_b();
  164.    }
  165.    
  166.    public OldServerPinger getPinger()
  167.    {
  168.        return this.pinger;
  169.    }
  170.    
  171.    /**
  172.     * Returns true if this GUI should pause the game when it is displayed in single-player
  173.     */
  174.    public boolean doesGuiPauseGame()
  175.    {
  176.        return false;
  177.    }
  178.  
  179.    /**
  180.     * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
  181.     */
  182.    protected void keyTyped(char p_73869_1_, int p_73869_2_)
  183.    {}
  184.  
  185.    /**
  186.     * Adds the buttons (and other controls) to the screen in question.
  187.     */
  188.    public void initGui()
  189.    {
  190.      
  191.        this.viewportTexture = new DynamicTexture(256, 256);
  192.        this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
  193.        Calendar calendar = Calendar.getInstance();
  194.        calendar.setTime(new Date());
  195.  
  196.        if(calendar.get(2) + 1 == 11 && calendar.get(5) == 9)
  197.        {
  198.            this.splashText = "Happy birthday, ez!";
  199.        }
  200.        else if(calendar.get(2) + 1 == 6 && calendar.get(5) == 1)
  201.        {
  202.            this.splashText = "Joyeux anniversaire notch :D";
  203.        }
  204.        else if(calendar.get(2) + 1 == 12 && calendar.get(5) == 24)
  205.        {
  206.            this.splashText = "Joyeux noël";
  207.        }
  208.        else if(calendar.get(2) + 1 == 1 && calendar.get(5) == 1)
  209.        {
  210.            this.splashText = "Bonne année !";
  211.        }
  212.        else if(calendar.get(2) + 1 == 10 && calendar.get(5) == 31)
  213.        {
  214.            this.splashText = "OOoooOOOoooo! Spooky!";
  215.        } else if(calendar.get(2) + 1 == 11 && calendar.get(5) == 17) {
  216.              this.splashText = "Joyeux anniversaire ph1823 !!!";
  217.        }
  218.  
  219.        boolean flag = true;
  220.        int i = this.height / 4 + 48;
  221.  
  222.        if(this.mc.isDemo())
  223.        {
  224.            this.addDemoButtons(i, 24);
  225.        }
  226.        else
  227.        {
  228.          
  229.            this.addSingleplayerMultiplayerButtons(i, 24);
  230.        }
  231.  
  232.        this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 + 12, 98, 20, I18n.format("menu.options", new Object[0])));
  233.        this.buttonList.add(new GuiButton(4, this.width / 2 + 2, i + 72 + 12, 98, 20, I18n.format("menu.quit", new Object[0])));
  234.        this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 12));
  235.        Object object = this.field_104025_t;
  236.  
  237.        synchronized(this.field_104025_t)
  238.        {
  239.            this.field_92023_s = this.fontRendererObj.getStringWidth(this.field_92025_p);
  240.            this.field_92024_r = this.fontRendererObj.getStringWidth(this.field_146972_A);
  241.            int j = Math.max(this.field_92023_s, this.field_92024_r);
  242.            this.field_92022_t = (this.width - j) / 2;
  243.            this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
  244.            this.field_92020_v = this.field_92022_t + j;
  245.            this.field_92019_w = this.field_92021_u + 24;
  246.            
  247.        }
  248.  
  249.    }
  250.  
  251.    /**
  252.     * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
  253.     */
  254.    private void addSingleplayerMultiplayerButtons(int x, int y)
  255.    {
  256.             int i = this.height / 4 + 48;
  257.         this.buttonList.add(new GuiButton(30, this.width / 2, i + 24 * 2, 100, 20, "Teamspeak") {
  258.            @Override
  259.            public void mouseReleased(int x, int y) {
  260.               if (Desktop.isDesktopSupported()) {
  261.                  try {
  262.                     Desktop.getDesktop().browse(new URI("ts3server://" +/*51.254.149.192:9008/*/"ts.stereo973.nl:10232?Nickname=" + Minecraft.getMinecraft().getSession().getUsername()));
  263.                  } catch (Exception e) {
  264.                     RoylityCraft.LOGGER.warn("Douldn't open teamspeak", e);
  265.                  }
  266.               }
  267.            }
  268.         });
  269.        
  270.         this.buttonList.add(new GuiButton(31, this.width / 2 - 100, i + 24 * 2, 100, 20, "Boutique") {
  271.            @Override
  272.            public void mouseReleased(int x, int y) {
  273.               if (Desktop.isDesktopSupported()) {
  274.                  try {
  275.                     Desktop.getDesktop().browse(new URI("http://mylife.glorycraft.fr/boutique"));
  276.                  } catch (Exception e) {
  277.                     RoylityCraft.LOGGER.warn("Douldn't open Boutique", e);
  278.                  }
  279.               }
  280.            }
  281.         });
  282.        
  283.         this.buttonList.add(new GuiButton(32, this.width / 2 - 100, i + 24, 200, 20, "Site") {
  284.            @Override
  285.            public void mouseReleased(int x, int y) {
  286.               if (Desktop.isDesktopSupported()) {
  287.                  try {
  288.                     Desktop.getDesktop().browse(new URI("http://mylife.glorycraft.fr/"));
  289.                  } catch (Exception e) {
  290.                     RoylityCraft.LOGGER.warn("Douldn't open le site", e);
  291.                  }
  292.               }
  293.            }
  294.         });
  295.      
  296.         this.buttonList.add(new CustomButton(33, this.width / 2 - 100, i, 200, 20, this));
  297.    }
  298.  
  299.    /**
  300.     * Adds Demo buttons on Main Menu for players who are playing Demo.
  301.     */
  302.    private void addDemoButtons(int x, int y)
  303.    {
  304.      
  305.        this.buttonList.add(new GuiButton(11, this.width / 2 - 100, x, I18n.format("menu.playdemo", new Object[0])));
  306.        this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, x + y * 1, I18n.format("menu.resetdemo", new Object[0])));
  307.        ISaveFormat isaveformat = this.mc.getSaveLoader();
  308.        WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
  309.  
  310.        if(worldinfo == null)
  311.        {
  312.            this.buttonResetDemo.enabled = false;
  313.        }
  314.    }
  315.  
  316.    protected void actionPerformed(GuiButton button)
  317.    {
  318.        if(button.id == 0)
  319.        {
  320.            this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
  321.        }
  322.  
  323.        if(button.id == 5)
  324.        {
  325.            this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
  326.        }
  327.  
  328.        if(button.id == 1)
  329.        {
  330.            this.mc.displayGuiScreen(new GuiSelectWorld(this));
  331.        }
  332.  
  333.        if(button.id == 2)
  334.        {
  335.            this.mc.displayGuiScreen(new GuiMultiplayer(this));
  336.        }
  337.  
  338.        if(button.id == 4)
  339.        {
  340.            this.mc.shutdown();
  341.        }
  342.  
  343.        if(button.id == 6)
  344.        {
  345.            this.mc.displayGuiScreen(new GuiModList(this));
  346.        }
  347.  
  348.        if(button.id == 11)
  349.        {
  350.            this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
  351.        }
  352.  
  353.        if(button.id == 12)
  354.        {
  355.            ISaveFormat isaveformat = this.mc.getSaveLoader();
  356.            WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
  357.  
  358.            if(worldinfo != null)
  359.            {
  360.                GuiYesNo guiyesno = GuiSelectWorld.func_152129_a(this, worldinfo.getWorldName(), 12);
  361.                this.mc.displayGuiScreen(guiyesno);
  362.            }
  363.        }
  364.        
  365.        if(button.id == 33)
  366.        {
  367.            // TODO pour la connexion au serveur
  368.  
  369.            FMLClientHandler.instance().connectToServerAtStartup("gloryofrp.glorycraft.fr", 25565); // ip, port
  370.        }
  371.  
  372.        if(button.id == 21)
  373.        {
  374.            try
  375.            {
  376.                Class oclass = Class.forName("java.awt.Desktop");
  377.                Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
  378.                oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI("http://glorycraft.fr")});
  379.            }
  380.            catch(Throwable throwable)
  381.            {
  382.                logger.error("Couldn\'t open link", throwable);
  383.            }
  384.        }
  385.    }
  386.  
  387.    public void confirmClicked(boolean p_73878_1_, int id)
  388.    {
  389.        if(p_73878_1_ && id == 12)
  390.        {
  391.            ISaveFormat isaveformat = this.mc.getSaveLoader();
  392.            isaveformat.flushCache();
  393.            isaveformat.deleteWorldDirectory("Demo_World");
  394.            this.mc.displayGuiScreen(this);
  395.        }
  396.        else if(id == 13)
  397.        {
  398.            if(p_73878_1_)
  399.            {
  400.                try
  401.                {
  402.                    Class oclass = Class.forName("java.awt.Desktop");
  403.                    Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
  404.                    oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(this.field_104024_v)});
  405.                }
  406.                catch(Throwable throwable)
  407.                {
  408.                    logger.error("Couldn\'t open link", throwable);
  409.                }
  410.            }
  411.  
  412.            this.mc.displayGuiScreen(this);
  413.        }
  414.    }
  415.  
  416.    /**
  417.     * Draws the main menu panorama
  418.     */
  419.    private void drawPanorama(int x, int y, float partialTick)
  420.    {
  421.        Tessellator tessellator = Tessellator.instance;
  422.        GL11.glMatrixMode(GL11.GL_PROJECTION);
  423.        GL11.glPushMatrix();
  424.        GL11.glLoadIdentity();
  425.        Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
  426.        GL11.glMatrixMode(GL11.GL_MODELVIEW);
  427.        GL11.glPushMatrix();
  428.        GL11.glLoadIdentity();
  429.        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  430.        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
  431.        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
  432.        GL11.glEnable(GL11.GL_BLEND);
  433.        GL11.glDisable(GL11.GL_ALPHA_TEST);
  434.        GL11.glDisable(GL11.GL_CULL_FACE);
  435.        GL11.glDepthMask(false);
  436.        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
  437.        byte b0 = 8;
  438.  
  439.        for(int k = 0; k < b0 * b0; ++k)
  440.        {
  441.            GL11.glPushMatrix();
  442.            float f1 = ((float)(k % b0) / (float)b0 - 0.5F) / 64.0F;
  443.            float f2 = ((float)(k / b0) / (float)b0 - 0.5F) / 64.0F;
  444.            float f3 = 0.0F;
  445.            GL11.glTranslatef(f1, f2, f3);
  446.            GL11.glRotatef(MathHelper.sin(((float)this.panoramaTimer + partialTick) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
  447.            GL11.glRotatef(-((float)this.panoramaTimer + partialTick) * 0.1F, 0.0F, 1.0F, 0.0F);
  448.  
  449.            for(int l = 0; l < 6; ++l)
  450.            {
  451.                GL11.glPushMatrix();
  452.  
  453.                if(l == 1)
  454.                {
  455.                    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
  456.                }
  457.  
  458.                if(l == 2)
  459.                {
  460.                    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
  461.                }
  462.  
  463.                if(l == 3)
  464.                {
  465.                    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
  466.                }
  467.  
  468.                if(l == 4)
  469.                {
  470.                    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
  471.                }
  472.  
  473.                if(l == 5)
  474.                {
  475.                    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
  476.                }
  477.  
  478.                this.mc.getTextureManager().bindTexture(titlePanoramaPaths);
  479.                tessellator.startDrawingQuads();
  480.                tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
  481.                float f4 = 0.0F;
  482.                tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double)(0.0F + f4), (double)(0.0F + f4));
  483.                tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double)(1.0F - f4), (double)(0.0F + f4));
  484.                tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double)(1.0F - f4), (double)(1.0F - f4));
  485.                tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double)(0.0F + f4), (double)(1.0F - f4));
  486.                tessellator.draw();
  487.                GL11.glPopMatrix();
  488.            }
  489.  
  490.            GL11.glPopMatrix();
  491.            GL11.glColorMask(true, true, true, false);
  492.        }
  493.  
  494.        tessellator.setTranslation(0.0D, 0.0D, 0.0D);
  495.        GL11.glColorMask(true, true, true, true);
  496.        GL11.glMatrixMode(GL11.GL_PROJECTION);
  497.        GL11.glPopMatrix();
  498.        GL11.glMatrixMode(GL11.GL_MODELVIEW);
  499.        GL11.glPopMatrix();
  500.        GL11.glDepthMask(true);
  501.        GL11.glEnable(GL11.GL_CULL_FACE);
  502.        GL11.glEnable(GL11.GL_DEPTH_TEST);
  503.    }
  504.  
  505.    /**
  506.     * Rotate and blurs the skybox view in the main menu
  507.     */
  508.    private void rotateAndBlurSkybox(float partialTick)
  509.    {
  510.        this.mc.getTextureManager().bindTexture(this.field_110351_G);
  511.        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
  512.        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
  513.        GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
  514.        GL11.glEnable(GL11.GL_BLEND);
  515.        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
  516.        GL11.glColorMask(true, true, true, false);
  517.        Tessellator tessellator = Tessellator.instance;
  518.        tessellator.startDrawingQuads();
  519.        GL11.glDisable(GL11.GL_ALPHA_TEST);
  520.        byte b0 = 3;
  521.  
  522.        for(int i = 0; i < b0; ++i)
  523.        {
  524.            tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1));
  525.            int j = this.width;
  526.            int k = this.height;
  527.            float f1 = (float)(i - b0 / 2) / 256.0F;
  528.            tessellator.addVertexWithUV((double)j, (double)k, (double)this.zLevel, (double)(0.0F + f1), 1.0D);
  529.            tessellator.addVertexWithUV((double)j, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 1.0D);
  530.            tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 0.0D);
  531.            tessellator.addVertexWithUV(0.0D, (double)k, (double)this.zLevel, (double)(0.0F + f1), 0.0D);
  532.        }
  533.  
  534.        tessellator.draw();
  535.        GL11.glEnable(GL11.GL_ALPHA_TEST);
  536.        GL11.glColorMask(true, true, true, true);
  537.    }
  538.  
  539.    /**
  540.     * Renders the skybox in the main menu
  541.     */
  542.    private void renderSkybox(int x, int y, float partialTick)
  543.    {
  544.        this.mc.getFramebuffer().unbindFramebuffer();
  545.        GL11.glViewport(0, 0, 256, 256);
  546.        this.drawPanorama(x, y, partialTick);
  547.        this.rotateAndBlurSkybox(partialTick);
  548.        this.rotateAndBlurSkybox(partialTick);
  549.        this.rotateAndBlurSkybox(partialTick);
  550.        this.rotateAndBlurSkybox(partialTick);
  551.        this.rotateAndBlurSkybox(partialTick);
  552.        this.rotateAndBlurSkybox(partialTick);
  553.        this.rotateAndBlurSkybox(partialTick);
  554.        this.mc.getFramebuffer().bindFramebuffer(true);
  555.        GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
  556.        Tessellator tessellator = Tessellator.instance;
  557.        tessellator.startDrawingQuads();
  558.        float f1 = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height;
  559.        float f2 = (float)this.height * f1 / 256.0F;
  560.        float f3 = (float)this.width * f1 / 256.0F;
  561.        tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
  562.        int k = this.width;
  563.        int l = this.height;
  564.        tessellator.addVertexWithUV(0.0D, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F + f3));
  565.        tessellator.addVertexWithUV((double)k, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F - f3));
  566.        tessellator.addVertexWithUV((double)k, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F - f3));
  567.        tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F + f3));
  568.        tessellator.draw();
  569.    }
  570.  
  571.    /**
  572.     * Draws the screen and all the components in it.
  573.     */
  574.    public void drawScreen(int x, int y, float partialTick)
  575.    {
  576.    
  577.        GL11.glDisable(GL11.GL_ALPHA_TEST);
  578.        this.renderSkybox(x, y, partialTick);
  579.        GL11.glEnable(GL11.GL_ALPHA_TEST);
  580.        Tessellator tessellator = Tessellator.instance;
  581.        short short1 = 274;
  582.        int k = this.width / 2 - short1 / 2;
  583.        byte b0 = 30;
  584.        this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
  585.        this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
  586.        this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
  587.        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  588.  
  589.        if((double)this.updateCounter < 1.0E-4D)
  590.        {
  591.            this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
  592.            this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
  593.            this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
  594.            this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44);
  595.            this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
  596.        }
  597.        else
  598.        {
  599.            this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44);
  600.            this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
  601.        }
  602.  
  603.        tessellator.setColorOpaque_I(-1);
  604.        GL11.glPushMatrix();
  605.        GL11.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
  606.        GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
  607.        float f1 = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
  608.        f1 = f1 * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
  609.        GL11.glScalef(f1, f1, f1);
  610.        this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
  611.        GL11.glPopMatrix();
  612.        String s = "Minecraft 1.7.10";
  613.  
  614.        if(this.mc.isDemo())
  615.        {
  616.            s = s + " Demo";
  617.        }
  618.  
  619.        List<String> brandings = Lists.reverse(FMLCommonHandler.instance().getBrandings(true));
  620.        for(int i = 0; i < brandings.size(); i++)
  621.        {
  622.            String brd = brandings.get(i);
  623.            if(!Strings.isNullOrEmpty(brd))
  624.            {
  625.                this.drawString(this.fontRendererObj, brd, 2, this.height - (10 + i * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215);
  626.            }
  627.        }
  628.        String s1 = "© Mojang AB Menu by ph1823";
  629.        RoylityCraft.height = this.height - 10;
  630.        RoylityCraft.with = -1;
  631.        this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, RoylityCraft.height,  RoylityCraft.with);
  632.  
  633.        if(this.field_92025_p != null && this.field_92025_p.length() > 0)
  634.        {
  635.            drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
  636.            this.drawString(this.fontRendererObj, this.field_92025_p, this.field_92022_t, this.field_92021_u, -1);
  637.            this.drawString(this.fontRendererObj, this.field_146972_A, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
  638.        }
  639.  
  640.        super.drawScreen(x, y, partialTick);
  641.    }
  642.  
  643.    /**
  644.     * Called when the mouse is clicked.
  645.     */
  646.    protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_)
  647.    {
  648.        super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
  649.        Object object = this.field_104025_t;
  650.  
  651.        synchronized(this.field_104025_t)
  652.        {
  653.            if(this.field_92025_p.length() > 0 && p_73864_1_ >= this.field_92022_t && p_73864_1_ <= this.field_92020_v && p_73864_2_ >= this.field_92021_u && p_73864_2_ <= this.field_92019_w)
  654.            {
  655.                GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.field_104024_v, 13, true);
  656.                guiconfirmopenlink.func_146358_g();
  657.                this.mc.displayGuiScreen(guiconfirmopenlink);
  658.            }
  659.        }
  660.    }
  661. }[/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement