/// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            DrawDefaultBackground();
            int i = GuiLeft;
            int j = GuiTop;

            DrawGuiContainerBackgroundLayer(par3, par1, par2);
            RenderHelper.EnableGUIStandardItemLighting();
            //GL.PushMatrix();
            //GL.Translate(i, j, 0.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Enable(EnableCap.RescaleNormal);
            Slot slot = null;
            int  k    = 240;
            int  i1   = 240;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)k / 1.0F, (float)i1 / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

            for (int l = 0; l < InventorySlots.InventorySlots.Count; l++)
            {
                Slot slot1 = (Slot)InventorySlots.InventorySlots[l];
                DrawSlotInventory(slot1);

                if (IsMouseOverSlot(slot1, par1, par2))
                {
                    slot = slot1;
                    //GL.Disable(EnableCap.Lighting);
                    //GL.Disable(EnableCap.DepthTest);
                    int j1 = slot1.XDisplayPosition;
                    int k1 = slot1.YDisplayPosition;
                    DrawGradientRect(j1, k1, j1 + 16, k1 + 16, 0x80fffff, 0x80fffff);
                    //GL.Enable(EnableCap.Lighting);
                    //GL.Enable(EnableCap.DepthTest);
                }
            }

            DrawGuiContainerForegroundLayer();
            InventoryPlayer inventoryplayer = Mc.ThePlayer.Inventory;

            if (inventoryplayer.GetItemStack() != null)
            {
                //GL.Translate(0.0F, 0.0F, 32F);
                ZLevel = 200F;
                ItemRenderer.ZLevel = 200F;
                ItemRenderer.RenderItemIntoGUI(FontRenderer, Mc.RenderEngineOld, inventoryplayer.GetItemStack(), par1 - i - 8, par2 - j - 8);
                ItemRenderer.RenderItemOverlayIntoGUI(FontRenderer, Mc.RenderEngineOld, inventoryplayer.GetItemStack(), par1 - i - 8, par2 - j - 8);
                ZLevel = 0.0F;
                ItemRenderer.ZLevel = 0.0F;
            }

            //GL.Disable(EnableCap.RescaleNormal);
            RenderHelper.DisableStandardItemLighting();
            //GL.Disable(EnableCap.Lighting);
            //GL.Disable(EnableCap.DepthTest);

            if (inventoryplayer.GetItemStack() == null && slot != null && slot.GetHasStack())
            {
                ItemStack     itemstack = slot.GetStack();
                List <string> list      = itemstack.GetItemNameandInformation();

                if (list.Count > 0)
                {
                    int l1 = 0;

                    for (int i2 = 0; i2 < list.Count; i2++)
                    {
                        int k2 = FontRenderer.GetStringWidth(list[i2]);

                        if (k2 > l1)
                        {
                            l1 = k2;
                        }
                    }

                    int j2 = (par1 - i) + 12;
                    int l2 = par2 - j - 12;
                    int i3 = l1;
                    int j3 = 8;

                    if (list.Count > 1)
                    {
                        j3 += 2 + (list.Count - 1) * 10;
                    }

                    ZLevel = 300F;
                    ItemRenderer.ZLevel = 300F;
                    int k3 = 0xf010001;
                    DrawGradientRect(j2 - 3, l2 - 4, j2 + i3 + 3, l2 - 3, k3, k3);
                    DrawGradientRect(j2 - 3, l2 + j3 + 3, j2 + i3 + 3, l2 + j3 + 4, k3, k3);
                    DrawGradientRect(j2 - 3, l2 - 3, j2 + i3 + 3, l2 + j3 + 3, k3, k3);
                    DrawGradientRect(j2 - 4, l2 - 3, j2 - 3, l2 + j3 + 3, k3, k3);
                    DrawGradientRect(j2 + i3 + 3, l2 - 3, j2 + i3 + 4, l2 + j3 + 3, k3, k3);
                    int l3 = 0x505000ff;
                    int i4 = (l3 & 0xfefefe) >> 1 | l3 & 0xff00000;
                    DrawGradientRect(j2 - 3, (l2 - 3) + 1, (j2 - 3) + 1, (l2 + j3 + 3) - 1, l3, i4);
                    DrawGradientRect(j2 + i3 + 2, (l2 - 3) + 1, j2 + i3 + 3, (l2 + j3 + 3) - 1, l3, i4);
                    DrawGradientRect(j2 - 3, l2 - 3, j2 + i3 + 3, (l2 - 3) + 1, l3, l3);
                    DrawGradientRect(j2 - 3, l2 + j3 + 2, j2 + i3 + 3, l2 + j3 + 3, i4, i4);

                    for (int j4 = 0; j4 < list.Count; j4++)
                    {
                        string s = list[j4];

                        if (j4 == 0)
                        {
                            //s = (new StringBuilder()).Append((char)0xa7).Append(int.ToHexString(itemstack.GetRarity().NameColor)).Append(s).ToString();
                        }
                        else
                        {
                            s = (new StringBuilder()).Append((char)0xa7).Append(s).ToString();
                        }

                        FontRenderer.DrawStringWithShadow(s, j2, l2, -1);

                        if (j4 == 0)
                        {
                            l2 += 2;
                        }

                        l2 += 10;
                    }

                    ZLevel = 0.0F;
                    ItemRenderer.ZLevel = 0.0F;
                }
            }

            //GL.PopMatrix();
            base.DrawScreen(par1, par2, par3);
            //GL.Enable(EnableCap.Lighting);
            //GL.Enable(EnableCap.DepthTest);
        }
示例#2
0
        /// <summary>
        /// Render the ingame overlay with quick icon bar, ...
        /// </summary>
        public virtual void RenderGameOverlay(float par1, bool par2, int par3, int par4)
        {
            ScaledResolution scaledresolution = new ScaledResolution(mc.GameSettings, mc.DisplayWidth, mc.DisplayHeight);
            int          i            = scaledresolution.GetScaledWidth();
            int          j            = scaledresolution.GetScaledHeight();
            FontRenderer fontrenderer = mc.FontRenderer;

            mc.EntityRenderer.SetupOverlayRendering();
            //GL.Enable(EnableCap.Blend);

            if (Minecraft.IsFancyGraphicsEnabled())
            {
                RenderVignette(mc.ThePlayer.GetBrightness(par1), i, j);
            }
            else
            {
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            }

            ItemStack itemstack = mc.ThePlayer.Inventory.ArmorItemInSlot(3);

            if (mc.GameSettings.ThirdPersonView == 0 && itemstack != null && itemstack.ItemID == Block.Pumpkin.BlockID)
            {
                RenderPumpkinBlur(i, j);
            }

            if (!mc.ThePlayer.IsPotionActive(Potion.Confusion))
            {
                float f = mc.ThePlayer.PrevTimeInPortal + (mc.ThePlayer.TimeInPortal - mc.ThePlayer.PrevTimeInPortal) * par1;

                if (f > 0.0F)
                {
                    RenderPortalOverlay(f, i, j);
                }
            }

            if (!mc.PlayerController.Func_35643_e())
            {
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/gui/gui.png"));
                InventoryPlayer inventoryplayer = mc.ThePlayer.Inventory;
                ZLevel = -90F;
                DrawTexturedModalRect(i / 2 - 91, j - 22, 0, 0, 182, 22);
                DrawTexturedModalRect((i / 2 - 91 - 1) + inventoryplayer.CurrentItem * 20, j - 22 - 1, 0, 22, 24, 22);
                //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/gui/icons.png"));
                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.OneMinusDstColor, BlendingFactorDest.OneMinusSrcColor);
                DrawTexturedModalRect(i / 2 - 7, j / 2 - 7, 0, 0, 16, 16);
                //GL.Disable(EnableCap.Blend);
                bool flag = (mc.ThePlayer.HeartsLife / 3) % 2 == 1;

                if (mc.ThePlayer.HeartsLife < 10)
                {
                    flag = false;
                }

                int i1 = mc.ThePlayer.GetHealth();
                int i2 = mc.ThePlayer.PrevHealth;
                rand.SetSeed(updateCounter * 0x4c627);
                bool      flag2     = false;
                FoodStats foodstats = mc.ThePlayer.GetFoodStats();
                int       j4        = foodstats.GetFoodLevel();
                int       l4        = foodstats.GetPrevFoodLevel();
                RenderBossHealth();

                if (mc.PlayerController.ShouldDrawHUD())
                {
                    int j5 = i / 2 - 91;
                    int i6 = i / 2 + 91;
                    int l6 = mc.ThePlayer.XpBarCap();

                    if (l6 > 0)
                    {
                        int c  = 0xb6;
                        int j8 = (int)(mc.ThePlayer.Experience * (float)(c + 1));
                        int i9 = (j - 32) + 3;
                        DrawTexturedModalRect(j5, i9, 0, 64, c, 5);

                        if (j8 > 0)
                        {
                            DrawTexturedModalRect(j5, i9, 0, 69, j8, 5);
                        }
                    }

                    int k7  = j - 39;
                    int k8  = k7 - 10;
                    int j9  = mc.ThePlayer.GetTotalArmorValue();
                    int i10 = -1;

                    if (mc.ThePlayer.IsPotionActive(Potion.Regeneration))
                    {
                        i10 = updateCounter % 25;
                    }

                    for (int j10 = 0; j10 < 10; j10++)
                    {
                        if (j9 > 0)
                        {
                            int i11 = j5 + j10 * 8;

                            if (j10 * 2 + 1 < j9)
                            {
                                DrawTexturedModalRect(i11, k8, 34, 9, 9, 9);
                            }

                            if (j10 * 2 + 1 == j9)
                            {
                                DrawTexturedModalRect(i11, k8, 25, 9, 9, 9);
                            }

                            if (j10 * 2 + 1 > j9)
                            {
                                DrawTexturedModalRect(i11, k8, 16, 9, 9, 9);
                            }
                        }

                        int j11 = 16;

                        if (mc.ThePlayer.IsPotionActive(Potion.Poison))
                        {
                            j11 += 36;
                        }

                        int i12 = 0;

                        if (flag)
                        {
                            i12 = 1;
                        }

                        int l12 = j5 + j10 * 8;
                        int j13 = k7;

                        if (i1 <= 4)
                        {
                            j13 += rand.Next(2);
                        }

                        if (j10 == i10)
                        {
                            j13 -= 2;
                        }

                        byte byte3 = 0;

                        if (mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled())
                        {
                            byte3 = 5;
                        }

                        DrawTexturedModalRect(l12, j13, 16 + i12 * 9, 9 * byte3, 9, 9);

                        if (flag)
                        {
                            if (j10 * 2 + 1 < i2)
                            {
                                DrawTexturedModalRect(l12, j13, j11 + 54, 9 * byte3, 9, 9);
                            }

                            if (j10 * 2 + 1 == i2)
                            {
                                DrawTexturedModalRect(l12, j13, j11 + 63, 9 * byte3, 9, 9);
                            }
                        }

                        if (j10 * 2 + 1 < i1)
                        {
                            DrawTexturedModalRect(l12, j13, j11 + 36, 9 * byte3, 9, 9);
                        }

                        if (j10 * 2 + 1 == i1)
                        {
                            DrawTexturedModalRect(l12, j13, j11 + 45, 9 * byte3, 9, 9);
                        }
                    }

                    for (int k10 = 0; k10 < 10; k10++)
                    {
                        int  k11   = k7;
                        int  j12   = 16;
                        byte byte2 = 0;

                        if (mc.ThePlayer.IsPotionActive(Potion.Hunger))
                        {
                            j12  += 36;
                            byte2 = 13;
                        }

                        if (mc.ThePlayer.GetFoodStats().GetSaturationLevel() <= 0.0F && updateCounter % (j4 * 3 + 1) == 0)
                        {
                            k11 += rand.Next(3) - 1;
                        }

                        if (flag2)
                        {
                            byte2 = 1;
                        }

                        int k13 = i6 - k10 * 8 - 9;
                        DrawTexturedModalRect(k13, k11, 16 + byte2 * 9, 27, 9, 9);

                        if (flag2)
                        {
                            if (k10 * 2 + 1 < l4)
                            {
                                DrawTexturedModalRect(k13, k11, j12 + 54, 27, 9, 9);
                            }

                            if (k10 * 2 + 1 == l4)
                            {
                                DrawTexturedModalRect(k13, k11, j12 + 63, 27, 9, 9);
                            }
                        }

                        if (k10 * 2 + 1 < j4)
                        {
                            DrawTexturedModalRect(k13, k11, j12 + 36, 27, 9, 9);
                        }

                        if (k10 * 2 + 1 == j4)
                        {
                            DrawTexturedModalRect(k13, k11, j12 + 45, 27, 9, 9);
                        }
                    }

                    if (mc.ThePlayer.IsInsideOfMaterial(Material.Water))
                    {
                        int l10 = mc.ThePlayer.GetAir();
                        int l11 = (int)Math.Ceiling(((double)(l10 - 2) * 10D) / 300D);
                        int k12 = (int)Math.Ceiling(((double)l10 * 10D) / 300D) - l11;

                        for (int i13 = 0; i13 < l11 + k12; i13++)
                        {
                            if (i13 < l11)
                            {
                                DrawTexturedModalRect(i6 - i13 * 8 - 9, k8, 16, 18, 9, 9);
                            }
                            else
                            {
                                DrawTexturedModalRect(i6 - i13 * 8 - 9, k8, 25, 18, 9, 9);
                            }
                        }
                    }
                }

                //GL.Disable(EnableCap.Blend);
                //GL.Enable(EnableCap.RescaleNormal);
                RenderHelper.EnableGUIStandardItemLighting();

                for (int k5 = 0; k5 < 9; k5++)
                {
                    int j6 = (i / 2 - 90) + k5 * 20 + 2;
                    int i7 = j - 16 - 3;
                    RenderInventorySlot(k5, j6, i7, par1);
                }

                RenderHelper.DisableStandardItemLighting();
                //GL.Disable(EnableCap.RescaleNormal);
            }

            if (mc.ThePlayer.GetSleepTimer() > 0)
            {
                //GL.Disable(EnableCap.DepthTest);
                //GL.Disable(EnableCap.AlphaTest);
                int   k  = mc.ThePlayer.GetSleepTimer();
                float f1 = (float)k / 100F;

                if (f1 > 1.0F)
                {
                    f1 = 1.0F - (float)(k - 100) / 10F;
                }

                int j1 = (int)(220F * f1) << 24 | 0x101020;
                DrawRect(0, 0, i, j, j1);
                //GL.Enable(EnableCap.AlphaTest);
                //GL.Enable(EnableCap.DepthTest);
            }

            if (mc.PlayerController.Func_35642_f() && mc.ThePlayer.ExperienceLevel > 0)
            {
                bool   flag1 = false;
                int    k1    = flag1 ? 0xffffff : 0x80ff20;
                String s     = (new StringBuilder()).Append("").Append(mc.ThePlayer.ExperienceLevel).ToString();
                int    i3    = (i - fontrenderer.GetStringWidth(s)) / 2;
                int    k3    = j - 31 - 4;
                fontrenderer.DrawString(s, i3 + 1, k3, 0);
                fontrenderer.DrawString(s, i3 - 1, k3, 0);
                fontrenderer.DrawString(s, i3, k3 + 1, 0);
                fontrenderer.DrawString(s, i3, k3 - 1, 0);
                fontrenderer.DrawString(s, i3, k3, k1);
            }

            if (mc.GameSettings.ShowDebugInfo)
            {
                //GL.PushMatrix();

                if (Minecraft.HasPaidCheckTime > 0L)
                {
                    //GL.Translate(0.0F, 32F, 0.0F);
                }

                fontrenderer.DrawStringWithShadow((new StringBuilder()).Append("Minecraft 1.2.5 (").Append(mc.Debug).Append(")").ToString(), 2, 2, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.DebugInfoRenders(), 2, 12, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.GetEntityDebug(), 2, 22, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.DebugInfoEntities(), 2, 32, 0xffffff);
                fontrenderer.DrawStringWithShadow(mc.GetWorldProviderName(), 2, 42, 0xffffff);
                //long l = Runtime.getRuntime().maxMemory();
                long l2 = GC.GetTotalMemory(false);
                //long l3 = Runtime.getRuntime().freeMemory();
                //long l5 = l2 - l3;
                //string s1 = (new StringBuilder()).Append("Used memory: ").Append((l5 * 100L) / l).Append("% (").Append(l5 / 1024L / 1024L).Append("MB) of ").Append(l / 1024L / 1024L).Append("MB").ToString();
                //DrawString(fontrenderer, s1, i - fontrenderer.GetStringWidth(s1) - 2, 2, 0xe0e0e0);
                //s1 = (new StringBuilder()).Append("Allocated memory: ").Append((l2 * 100L) / l).Append("% (").Append(l2 / 1024L / 1024L).Append("MB)").ToString();
                //DrawString(fontrenderer, s1, i - fontrenderer.GetStringWidth(s1) - 2, 12, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("x: ").Append(mc.ThePlayer.PosX).ToString(), 2, 64, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("y: ").Append(mc.ThePlayer.PosY).ToString(), 2, 72, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("z: ").Append(mc.ThePlayer.PosZ).ToString(), 2, 80, 0xe0e0e0);
                DrawString(fontrenderer, (new StringBuilder()).Append("f: ").Append((int)Math.Floor((double)((mc.ThePlayer.RotationYaw * 4F) / 360F) + 0.5D) & 3).ToString(), 2, 88, 0xe0e0e0);
                int l7 = (int)Math.Floor(mc.ThePlayer.PosX);
                int l8 = (int)Math.Floor(mc.ThePlayer.PosY);
                int k9 = (int)Math.Floor(mc.ThePlayer.PosZ);

                if (mc.TheWorld != null && mc.TheWorld.BlockExists(l7, l8, k9))
                {
                    Chunk chunk = mc.TheWorld.GetChunkFromBlockCoords(l7, k9);
                    DrawString(fontrenderer, (new StringBuilder()).Append("lc: ").Append(chunk.GetTopFilledSegment() + 15).Append(" b: ").Append(chunk.Func_48490_a(l7 & 0xf, k9 & 0xf, mc.TheWorld.GetWorldChunkManager()).BiomeName).Append(" bl: ").Append(chunk.GetSavedLightValue(SkyBlock.Block, l7 & 0xf, l8, k9 & 0xf)).Append(" sl: ").Append(chunk.GetSavedLightValue(SkyBlock.Sky, l7 & 0xf, l8, k9 & 0xf)).Append(" rl: ").Append(chunk.GetBlockLightValue(l7 & 0xf, l8, k9 & 0xf, 0)).ToString(), 2, 96, 0xe0e0e0);
                }

                if (!mc.TheWorld.IsRemote)
                {
                    DrawString(fontrenderer, (new StringBuilder()).Append("Seed: ").Append(mc.TheWorld.GetSeed()).ToString(), 2, 112, 0xe0e0e0);
                }

                //GL.PopMatrix();
            }

            if (recordPlayingUpFor > 0)
            {
                float f2 = (float)recordPlayingUpFor - par1;
                int   l1 = (int)((f2 * 256F) / 20F);

                if (l1 > 255)
                {
                    l1 = 255;
                }

                if (l1 > 0)
                {
                    //GL.PushMatrix();
                    //GL.Translate(i / 2, j - 48, 0.0F);
                    //GL.Enable(EnableCap.Blend);
                    //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                    int j2 = 0xffffff;

                    /*
                     * if (recordIsPlaying)
                     * {
                     *  j2 = Color.HSBtoRGB(f2 / 50F, 0.7F, 0.6F) & 0xffffff;
                     * }
                     */
                    fontrenderer.DrawString(recordPlaying, -(int)fontrenderer.GetStringWidth(recordPlaying) / 2, -4, j2 + (l1 << 24));
                    //GL.Disable(EnableCap.Blend);
                    //GL.PopMatrix();
                }
            }

            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Disable(EnableCap.AlphaTest);
            //GL.PushMatrix();
            //GL.Translate(0.0F, j - 48, 0.0F);
            Func_50010_a(fontrenderer);
            //GL.PopMatrix();

            if ((mc.ThePlayer is EntityClientPlayerMP) && mc.GameSettings.KeyBindPlayerList.Pressed)
            {
                NetClientHandler     netclienthandler = ((EntityClientPlayerMP)mc.ThePlayer).SendQueue;
                List <GuiPlayerInfo> list             = netclienthandler.PlayerNames;
                int k2 = netclienthandler.CurrentServerMaxPlayers;
                int j3 = k2;
                int i4 = 1;

                for (; j3 > 20; j3 = ((k2 + i4) - 1) / i4)
                {
                    i4++;
                }

                int k4 = 300 / i4;

                if (k4 > 150)
                {
                    k4 = 150;
                }

                int  i5    = (i - i4 * k4) / 2;
                byte byte0 = 10;
                DrawRect(i5 - 1, byte0 - 1, i5 + k4 * i4, byte0 + 9 * j3, 0x8000000);

                for (int k6 = 0; k6 < k2; k6++)
                {
                    int j7 = i5 + (k6 % i4) * k4;
                    int i8 = byte0 + (k6 / i4) * 9;
                    DrawRect(j7, i8, (j7 + k4) - 1, i8 + 8, 0x20ffffff);
                    //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                    //GL.Enable(EnableCap.AlphaTest);

                    if (k6 >= list.Count)
                    {
                        continue;
                    }

                    GuiPlayerInfo guiplayerinfo = (GuiPlayerInfo)list[k6];
                    fontrenderer.DrawStringWithShadow(guiplayerinfo.Name, j7, i8, 0xffffff);
                    mc.RenderEngineOld.BindTexture(mc.RenderEngineOld.GetTexture("/gui/icons.png"));
                    int  l9    = 0;
                    byte byte1 = 0;

                    if (guiplayerinfo.ResponseTime < 0)
                    {
                        byte1 = 5;
                    }
                    else if (guiplayerinfo.ResponseTime < 150)
                    {
                        byte1 = 0;
                    }
                    else if (guiplayerinfo.ResponseTime < 300)
                    {
                        byte1 = 1;
                    }
                    else if (guiplayerinfo.ResponseTime < 600)
                    {
                        byte1 = 2;
                    }
                    else if (guiplayerinfo.ResponseTime < 1000)
                    {
                        byte1 = 3;
                    }
                    else
                    {
                        byte1 = 4;
                    }

                    ZLevel += 100F;
                    DrawTexturedModalRect((j7 + k4) - 12, i8, 0 + l9 * 10, 176 + byte1 * 8, 10, 8);
                    ZLevel -= 100F;
                }
            }

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.AlphaTest);
        }