/// <summary>
        /// Renders the animation for when an enderdragon dies
        /// </summary>
        protected virtual void RenderDragonDying(EntityDragon par1EntityDragon, float par2)
        {
            base.RenderEquippedItems(par1EntityDragon, par2);
            Tessellator tessellator = Tessellator.Instance;

            if (par1EntityDragon.Field_40178_aA > 0)
            {
                RenderHelper.DisableStandardItemLighting();
                float f  = ((float)par1EntityDragon.Field_40178_aA + par2) / 200F;
                float f1 = 0.0F;

                if (f > 0.8F)
                {
                    f1 = (f - 0.8F) / 0.2F;
                }

                Random random = new Random(432);
                //GL.Disable(EnableCap.Texture2D);
                //GL.ShadeModel(ShadingModel.Smooth);
                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);
                //GL.Disable(EnableCap.AlphaTest);
                //GL.Enable(EnableCap.CullFace);
                //GL.DepthMask(false);
                //GL.PushMatrix();
                //GL.Translate(0.0F, -1F, -2F);

                for (int i = 0; (float)i < ((f + f * f) / 2.0F) * 60F; i++)
                {
                    //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F);
                    //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F);
                    //GL.Rotate(random.NextDouble() * 360F, 0.0F, 0.0F, 1.0F);
                    //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F);
                    //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F);
                    //GL.Rotate(random.NextDouble() * 360F + f * 90F, 0.0F, 0.0F, 1.0F);
                    tessellator.StartDrawing(6);
                    float f2 = (float)random.NextDouble() * 20F + 5F + f1 * 10F;
                    float f3 = (float)random.NextDouble() * 2.0F + 1.0F + f1 * 2.0F;
                    tessellator.SetColorRGBA_I(0xffffff, (int)(255F * (1.0F - f1)));
                    tessellator.AddVertex(0.0F, 0.0F, 0.0F);
                    tessellator.SetColorRGBA_I(0xff00ff, 0);
                    tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3);
                    tessellator.AddVertex(0.86599999999999999D * (double)f3, f2, -0.5F * f3);
                    tessellator.AddVertex(0.0F, f2, 1.0F * f3);
                    tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3);
                    tessellator.Draw();
                }

                //GL.PopMatrix();
                //GL.DepthMask(true);
                //GL.Disable(EnableCap.CullFace);
                //GL.Disable(EnableCap.Blend);
                //GL.ShadeModel(ShadingModel.Flat);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Enable(EnableCap.Texture2D);
                //GL.Enable(EnableCap.AlphaTest);
                RenderHelper.EnableStandardItemLighting();
            }
        }
        public virtual void Func_35438_a(EntityXPOrb par1EntityXPOrb, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            int i = par1EntityXPOrb.GetTextureByXP();

            LoadTexture("/item/xporb.png");
            Tessellator tessellator = Tessellator.Instance;
            float       f           = (float)((i % 4) * 16 + 0) / 64F;
            float       f1          = (float)((i % 4) * 16 + 16) / 64F;
            float       f2          = (float)((i / 4) * 16 + 0) / 64F;
            float       f3          = (float)((i / 4) * 16 + 16) / 64F;
            float       f4          = 1.0F;
            float       f5          = 0.5F;
            float       f6          = 0.25F;
            int         i7          = par1EntityXPOrb.GetBrightnessForRender(par9);
            float       f8          = i7 % 0x10000;
            int         j           = i7 / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)f8 / 1.0F, (float)j / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            float f7 = 255F;

            f8 = ((float)par1EntityXPOrb.XpColor + par9) / 2.0F;
            j  = (int)((MathHelper2.Sin(f8 + 0.0F) + 1.0F) * 0.5F * f7);
            int k  = (int)f7;
            int l  = (int)((MathHelper2.Sin(f8 + 4.18879F) + 1.0F) * 0.1F * f7);
            int i1 = j << 16 | k << 8 | l;
            //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
            float f9 = 0.3F;

            //GL.Scale(f9, f9, f9);
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_I(i1, 128);
            tessellator.SetNormal(0.0F, 1.0F, 0.0F);
            tessellator.AddVertexWithUV(0.0F - f5, 0.0F - f6, 0.0F, f, f3);
            tessellator.AddVertexWithUV(f4 - f5, 0.0F - f6, 0.0F, f1, f3);
            tessellator.AddVertexWithUV(f4 - f5, 1.0F - f6, 0.0F, f1, f2);
            tessellator.AddVertexWithUV(0.0F - f5, 1.0F - f6, 0.0F, f, f2);
            tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
Exemple #3
0
        /// <summary>
        /// draws the slot to the screen, pass in mouse's current x and y and partial ticks
        /// </summary>
        public virtual void DrawScreen(int par1, int par2, float par3)
        {
            MouseX = par1;
            MouseY = par2;
            DrawBackground();
            int i = GetSize();
            int j = Width / 2 + 124;
            int k = j + 6;

            if (Mc.Input.Mouse.WasButtonPressed(MouseButtons.Left))
            {
                if (InitialClickY == -1F)
                {
                    bool flag = true;

                    if (par2 >= Top && par2 <= Bottom)
                    {
                        int i1 = Width / 2 - 110;
                        int j1 = Width / 2 + 110;
                        int l1 = ((par2 - Top - Field_27261_r) + (int)AmountScrolled) - 4;
                        int j2 = l1 / SlotHeight;

                        if (par1 >= i1 && par1 <= j1 && j2 >= 0 && l1 >= 0 && j2 < i)
                        {
                            bool flag1 = j2 == SelectedElement && JavaHelper.CurrentTimeMillis() - LastClicked < 250L;
                            ElementClicked(j2, flag1);
                            SelectedElement = j2;
                            LastClicked     = JavaHelper.CurrentTimeMillis();
                        }
                        else if (par1 >= i1 && par1 <= j1 && l1 < 0)
                        {
                            Func_27255_a(par1 - i1, ((par2 - Top) + (int)AmountScrolled) - 4);
                            flag = false;
                        }

                        if (par1 >= j && par1 <= k)
                        {
                            ScrollMultiplier = -1F;
                            int l2 = GetContentHeight() - (Bottom - Top - 4);

                            if (l2 < 1)
                            {
                                l2 = 1;
                            }

                            int k3 = (int)((float)((Bottom - Top) * (Bottom - Top)) / (float)GetContentHeight());

                            if (k3 < 32)
                            {
                                k3 = 32;
                            }

                            if (k3 > Bottom - Top - 8)
                            {
                                k3 = Bottom - Top - 8;
                            }

                            ScrollMultiplier /= (float)(Bottom - Top - k3) / (float)l2;
                        }
                        else
                        {
                            ScrollMultiplier = 1.0F;
                        }

                        if (flag)
                        {
                            InitialClickY = par2;
                        }
                        else
                        {
                            InitialClickY = -2F;
                        }
                    }
                    else
                    {
                        InitialClickY = -2F;
                    }
                }
                else if (InitialClickY >= 0.0F)
                {
                    AmountScrolled -= ((float)par2 - InitialClickY) * ScrollMultiplier;
                    InitialClickY   = par2;
                }
            }
            else
            {            /*
                          *     do
                          *     {
                          *             if (!Mouse.next())
                          *             {
                          *                     break;
                          *             }
                          */
                int l = Mc.Input.Mouse.WheelDelta;

                if (l != 0)
                {
                    if (l > 0)
                    {
                        l = -1;
                    }
                    else if (l < 0)
                    {
                        l = 1;
                    }

                    AmountScrolled += (l * SlotHeight) / 2;
                }                        /*
                                          * }
                                          * while (true);*/

                InitialClickY = -1F;
            }

            BindAmountScrolled();
            //GL.Disable(EnableCap.Lighting);
            //GL.Disable(EnableCap.Fog);
            Tessellator tessellator = Tessellator.Instance;

            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/gui/background.png"));
            Mc.RenderEngine.BindTexture("gui.background.png");
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            float f = 32F;

            tessellator.StartDrawingQuads();
            tessellator.SetColorOpaque_I(0x202020);
            tessellator.AddVertexWithUV(Left, Bottom, 0.0F, (float)Left / f, (float)(Bottom + (int)AmountScrolled) / f);
            tessellator.AddVertexWithUV(Right, Bottom, 0.0F, (float)Right / f, (float)(Bottom + (int)AmountScrolled) / f);
            tessellator.AddVertexWithUV(Right, Top, 0.0F, (float)Right / f, (float)(Top + (int)AmountScrolled) / f);
            tessellator.AddVertexWithUV(Left, Top, 0.0F, (float)Left / f, (float)(Top + (int)AmountScrolled) / f);
            tessellator.Draw();
            int k1 = Width / 2 - 92 - 16;
            int i2 = (Top + 4) - (int)AmountScrolled;

            if (Field_27262_q)
            {
                Func_27260_a(k1, i2, tessellator);
            }

            for (int k2 = 0; k2 < i; k2++)
            {
                int i3 = i2 + k2 * SlotHeight + Field_27261_r;
                int l3 = SlotHeight - 4;

                if (i3 > Bottom || i3 + l3 < Top)
                {
                    continue;
                }

                if (Field_25123_p && IsSelected(k2))
                {
                    int j4 = Width / 2 - 110;
                    int l4 = Width / 2 + 110;
                    //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                    //GL.Disable(EnableCap.Texture2D);
                    tessellator.StartDrawingQuads();
                    tessellator.SetColorOpaque_I(0x808080);
                    tessellator.AddVertexWithUV(j4, i3 + l3 + 2, 0.0F, 0.0F, 1.0D);
                    tessellator.AddVertexWithUV(l4, i3 + l3 + 2, 0.0F, 1.0D, 1.0D);
                    tessellator.AddVertexWithUV(l4, i3 - 2, 0.0F, 1.0D, 0.0F);
                    tessellator.AddVertexWithUV(j4, i3 - 2, 0.0F, 0.0F, 0.0F);
                    tessellator.SetColorOpaque_I(0);
                    tessellator.AddVertexWithUV(j4 + 1, i3 + l3 + 1, 0.0F, 0.0F, 1.0D);
                    tessellator.AddVertexWithUV(l4 - 1, i3 + l3 + 1, 0.0F, 1.0D, 1.0D);
                    tessellator.AddVertexWithUV(l4 - 1, i3 - 1, 0.0F, 1.0D, 0.0F);
                    tessellator.AddVertexWithUV(j4 + 1, i3 - 1, 0.0F, 0.0F, 0.0F);
                    tessellator.Draw();
                    //GL.Enable(EnableCap.Texture2D);
                }

                DrawSlot(k2, k1, i3, l3, tessellator);
            }

            //GL.Disable(EnableCap.DepthTest);
            sbyte byte0 = 4;

            OverlayBackground(0, Top, 255, 255);
            OverlayBackground(Bottom, Height, 255, 255);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Disable(EnableCap.AlphaTest);
            //GL.ShadeModel(ShadingModel.Smooth);
            //GL.Disable(EnableCap.Texture2D);
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_I(0, 0);
            tessellator.AddVertexWithUV(Left, Top + byte0, 0.0F, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(Right, Top + byte0, 0.0F, 1.0D, 1.0D);
            tessellator.SetColorRGBA_I(0, 255);
            tessellator.AddVertexWithUV(Right, Top, 0.0F, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(Left, Top, 0.0F, 0.0F, 0.0F);
            tessellator.Draw();
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_I(0, 255);
            tessellator.AddVertexWithUV(Left, Bottom, 0.0F, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(Right, Bottom, 0.0F, 1.0D, 1.0D);
            tessellator.SetColorRGBA_I(0, 0);
            tessellator.AddVertexWithUV(Right, Bottom - byte0, 0.0F, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(Left, Bottom - byte0, 0.0F, 0.0F, 0.0F);
            tessellator.Draw();
            int j3 = GetContentHeight() - (Bottom - Top - 4);

            if (j3 > 0)
            {
                int i4 = ((Bottom - Top) * (Bottom - Top)) / GetContentHeight();

                if (i4 < 32)
                {
                    i4 = 32;
                }

                if (i4 > Bottom - Top - 8)
                {
                    i4 = Bottom - Top - 8;
                }

                int k4 = ((int)AmountScrolled * (Bottom - Top - i4)) / j3 + Top;

                if (k4 < Top)
                {
                    k4 = Top;
                }

                tessellator.StartDrawingQuads();
                tessellator.SetColorRGBA_I(0, 255);
                tessellator.AddVertexWithUV(j, Bottom, 0.0F, 0.0F, 1.0D);
                tessellator.AddVertexWithUV(k, Bottom, 0.0F, 1.0D, 1.0D);
                tessellator.AddVertexWithUV(k, Top, 0.0F, 1.0D, 0.0F);
                tessellator.AddVertexWithUV(j, Top, 0.0F, 0.0F, 0.0F);
                tessellator.Draw();
                tessellator.StartDrawingQuads();
                tessellator.SetColorRGBA_I(0x808080, 255);
                tessellator.AddVertexWithUV(j, k4 + i4, 0.0F, 0.0F, 1.0D);
                tessellator.AddVertexWithUV(k, k4 + i4, 0.0F, 1.0D, 1.0D);
                tessellator.AddVertexWithUV(k, k4, 0.0F, 1.0D, 0.0F);
                tessellator.AddVertexWithUV(j, k4, 0.0F, 0.0F, 0.0F);
                tessellator.Draw();
                tessellator.StartDrawingQuads();
                tessellator.SetColorRGBA_I(0xc0c0c0, 255);
                tessellator.AddVertexWithUV(j, (k4 + i4) - 1, 0.0F, 0.0F, 1.0D);
                tessellator.AddVertexWithUV(k - 1, (k4 + i4) - 1, 0.0F, 1.0D, 1.0D);
                tessellator.AddVertexWithUV(k - 1, k4, 0.0F, 1.0D, 0.0F);
                tessellator.AddVertexWithUV(j, k4, 0.0F, 0.0F, 0.0F);
                tessellator.Draw();
            }

            Func_27257_b(par1, par2);
            //GL.Enable(EnableCap.Texture2D);
            //GL.ShadeModel(ShadingModel.Flat);
            //GL.Enable(EnableCap.AlphaTest);
            //GL.Disable(EnableCap.Blend);
        }