示例#1
0
        /// <summary>
        /// Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
        /// specified position.
        /// </summary>
        public virtual void RenderItemOverlayIntoGUI(FontRenderer par1FontRenderer, RenderEngineOld par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
        {
            if (par3ItemStack == null)
            {
                return;
            }

            if (par3ItemStack.StackSize > 1)
            {
                string s = (new StringBuilder()).Append("").Append(par3ItemStack.StackSize).ToString();
                //GL.Disable(EnableCap.Lighting);
                //GL.Disable(EnableCap.DepthTest);
                par1FontRenderer.DrawStringWithShadow(s, (par4 + 19) - 2 - (int)par1FontRenderer.GetStringWidth(s), par5 + 6 + 3, 0xffffff);
                //GL.Enable(EnableCap.Lighting);
                //GL.Enable(EnableCap.DepthTest);
            }

            if (par3ItemStack.IsItemDamaged())
            {
                int i = (int)Math.Round(13D - ((double)par3ItemStack.GetItemDamageForDisplay() * 13D) / (double)par3ItemStack.GetMaxDamage());
                int j = (int)Math.Round(255D - ((double)par3ItemStack.GetItemDamageForDisplay() * 255D) / (double)par3ItemStack.GetMaxDamage());
                //GL.Disable(EnableCap.Lighting);
                //GL.Disable(EnableCap.DepthTest);
                //GL.Disable(EnableCap.Texture2D);
                Tessellator tessellator = Tessellator.Instance;
                int         k           = 255 - j << 16 | j << 8;
                int         l           = (255 - j) / 4 << 16 | 0x3f00;
                RenderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
                RenderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, l);
                RenderQuad(tessellator, par4 + 2, par5 + 13, i, 1, k);
                //GL.Enable(EnableCap.Texture2D);
                //GL.Enable(EnableCap.Lighting);
                //GL.Enable(EnableCap.DepthTest);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            }
        }