예제 #1
0
        ///<summary>
        /// Renders the vignette. Args: vignetteBrightness, width, height
        ///</summary>
        private void RenderVignette(float par1, int par2, int par3)
        {
            par1 = 1.0F - par1;

            if (par1 < 0.0F)
            {
                par1 = 0.0F;
            }

            if (par1 > 1.0F)
            {
                par1 = 1.0F;
            }

            PrevVignetteBrightness += par1 - PrevVignetteBrightness * 0.01F;
            //GL.Disable(EnableCap.DepthTest);
            //GL.DepthMask(false);
            //GL.BlendFunc(BlendingFactorSrc.Zero, BlendingFactorDest.OneMinusSrcColor);
            //GL.Color4(PrevVignetteBrightness, PrevVignetteBrightness, PrevVignetteBrightness, 1.0F);
            //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("%blur%/misc/vignette.png"));
            RenderEngine.Instance.BindTexture("misc.vignette.png", TextureMode.Blur);
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(0.0F, par3, -90D, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(par2, par3, -90D, 1.0D, 1.0D);
            tessellator.AddVertexWithUV(par2, 0.0F, -90D, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(0.0F, 0.0F, -90D, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.DepthMask(true);
            //GL.Enable(EnableCap.DepthTest);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
        }
예제 #2
0
        /// <summary>
        /// Renders the texture of the block the player is inside as an overlay. Args: partialTickTime, blockTextureIndex
        /// </summary>
        private void RenderInsideOfBlock(float par1, int par2)
        {
            Tessellator tessellator = Tessellator.Instance;
            float       f           = Mc.ThePlayer.GetBrightness(par1);

            f = 0.1F;
            //GL.Color4(f, f, f, 0.5F);
            //GL.PushMatrix();
            float f1  = -1F;
            float f2  = 1.0F;
            float f3  = -1F;
            float f4  = 1.0F;
            float f5  = -0.5F;
            float f6  = 0.0078125F;
            float f7  = (float)(par2 % 16) / 256F - f6;
            float f8  = ((float)(par2 % 16) + 15.99F) / 256F + f6;
            float f9  = (float)(par2 / 16) / 256F - f6;
            float f10 = ((float)(par2 / 16) + 15.99F) / 256F + f6;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(f1, f3, f5, f8, f10);
            tessellator.AddVertexWithUV(f2, f3, f5, f7, f10);
            tessellator.AddVertexWithUV(f2, f4, f5, f7, f9);
            tessellator.AddVertexWithUV(f1, f4, f5, f8, f9);
            tessellator.Draw();
            //GL.PopMatrix();
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
        }
예제 #3
0
        /// <summary>
        /// Renders a texture that warps around based on the direction the player is looking. Texture needs to be bound
        /// before being called. Used for the water overlay. Args: parialTickTime
        /// </summary>
        private void RenderWarpedTextureOverlay(float par1)
        {
            Tessellator tessellator = Tessellator.Instance;
            float       f           = Mc.ThePlayer.GetBrightness(par1);
            //GL.Color4(f, f, f, 0.5F);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.PushMatrix();
            float f1 = 4F;
            float f2 = -1F;
            float f3 = 1.0F;
            float f4 = -1F;
            float f5 = 1.0F;
            float f6 = -0.5F;
            float f7 = -Mc.ThePlayer.RotationYaw / 64F;
            float f8 = Mc.ThePlayer.RotationPitch / 64F;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(f2, f4, f6, f1 + f7, f1 + f8);
            tessellator.AddVertexWithUV(f3, f4, f6, 0.0F + f7, f1 + f8);
            tessellator.AddVertexWithUV(f3, f5, f6, 0.0F + f7, 0.0F + f8);
            tessellator.AddVertexWithUV(f2, f5, f6, f1 + f7, 0.0F + f8);
            tessellator.Draw();
            //GL.PopMatrix();
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.Blend);
        }
예제 #4
0
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f = ((float)Field_27018_a + par2) / (float)Field_27020_o;

            f *= f;
            float f1 = 2.0F - f * 2.0F;

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }

            f1 *= 0.2F;
            //GL.Disable(EnableCap.Lighting);
            float f2 = 0.125F;
            float f3 = (float)(PosX - InterpPosX);
            float f4 = (float)(PosY - InterpPosY);
            float f5 = (float)(PosZ - InterpPosZ);
            float f6 = WorldObj.GetLightBrightness(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosY), MathHelper2.Floor_double(PosZ));

            //CurrentFootSteps.BindTexture(CurrentFootSteps.GetTexture("/misc/footprint.png"));
            CurrentFootSteps.BindTexture("misc.footprint.png");
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetColorRGBA_F(f6, f6, f6, f1);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 + f2, 0.0F, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 + f2, 1.0D, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 - f2, 1.0D, 0.0F);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 - f2, 0.0F, 0.0F);
            par1Tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            //GL.Enable(EnableCap.Lighting);
        }
예제 #5
0
        ///<summary>
        /// Renders the portal overlay. Args: portalStrength, width, height
        ///</summary>
        private void RenderPortalOverlay(float par1, int par2, int par3)
        {
            if (par1 < 1.0F)
            {
                par1 *= par1;
                par1 *= par1;
                par1  = par1 * 0.8F + 0.2F;
            }

            //GL.Disable(EnableCap.AlphaTest);
            //GL.Disable(EnableCap.DepthTest);
            //GL.DepthMask(false);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Color4(1.0F, 1.0F, 1.0F, par1);
            //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("/terrain.png"));
            RenderEngine.Instance.BindTexture("terrain.png");
            float       f           = (float)(Block.Portal.BlockIndexInTexture % 16) / 16F;
            float       f1          = (float)(Block.Portal.BlockIndexInTexture / 16) / 16F;
            float       f2          = (float)(Block.Portal.BlockIndexInTexture % 16 + 1) / 16F;
            float       f3          = (float)(Block.Portal.BlockIndexInTexture / 16 + 1) / 16F;
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(0.0F, par3, -90D, f, f3);
            tessellator.AddVertexWithUV(par2, par3, -90D, f2, f3);
            tessellator.AddVertexWithUV(par2, 0.0F, -90D, f2, f1);
            tessellator.AddVertexWithUV(0.0F, 0.0F, -90D, f, f1);
            tessellator.Draw();
            //GL.DepthMask(true);
            //GL.Enable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.AlphaTest);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
        }
예제 #6
0
        private void Func_41040_b(int par1, int par2, float par3)
        {
            Tessellator tessellator = Tessellator.Instance;

            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("%blur%/gui/background.png"));
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
            int   i  = Width;
            float f  = 0.0F - ((float)UpdateCounter + par3) * 0.5F * Field_41043_e;
            float f1 = (float)Height - ((float)UpdateCounter + par3) * 0.5F * Field_41043_e;
            float f2 = 0.015625F;
            float f3 = (((float)UpdateCounter + par3) - 0.0F) * 0.02F;
            float f4 = (float)(Field_41042_d + Height + Height + 24) / Field_41043_e;
            float f5 = (f4 - 20F - ((float)UpdateCounter + par3)) * 0.005F;

            if (f5 < f3)
            {
                f3 = f5;
            }

            if (f3 > 1.0F)
            {
                f3 = 1.0F;
            }

            f3 *= f3;
            f3  = (f3 * 96F) / 255F;
            tessellator.SetColorOpaque_F(f3, f3, f3);
            tessellator.AddVertexWithUV(0.0F, Height, ZLevel, 0.0F, f * f2);
            tessellator.AddVertexWithUV(i, Height, ZLevel, (float)i * f2, f * f2);
            tessellator.AddVertexWithUV(i, 0.0F, ZLevel, (float)i * f2, f1 * f2);
            tessellator.AddVertexWithUV(0.0F, 0.0F, ZLevel, 0.0F, f1 * f2);
            tessellator.Draw();
        }
예제 #7
0
        private void Func_40266_a(int par1, int par2, int par3, int par4, int par5)
        {
            for (int i = 0; i < 2; i++)
            {
                if (i == 0)
                {
                    //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
                }

                if (i == 1)
                {
                    //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
                }

                float       f           = 0.00390625F;
                float       f1          = 0.00390625F;
                float       f2          = ((float)(JavaHelper.CurrentTimeMillis() % (long)(3000 + i * 1873)) / (3000F + (float)(i * 1873))) * 256F;
                float       f3          = 0.0F;
                Tessellator tessellator = Tessellator.Instance;
                float       f4          = 4F;

                if (i == 1)
                {
                    f4 = -1F;
                }

                tessellator.StartDrawingQuads();
                tessellator.AddVertexWithUV(par2 + 0, par3 + par5, ZLevel, (f2 + (float)par5 * f4) * f, (f3 + (float)par5) * f1);
                tessellator.AddVertexWithUV(par2 + par4, par3 + par5, ZLevel, (f2 + (float)par4 + (float)par5 * f4) * f, (f3 + (float)par5) * f1);
                tessellator.AddVertexWithUV(par2 + par4, par3 + 0, ZLevel, (f2 + (float)par4) * f, (f3 + 0.0F) * f1);
                tessellator.AddVertexWithUV(par2 + 0, par3 + 0, ZLevel, (f2 + 0.0F) * f, (f3 + 0.0F) * f1);
                tessellator.Draw();
            }
        }
예제 #8
0
        private void Func_40267_a(int par1, int par2)
        {
            Tessellator tessellator = Tessellator.Instance;
            float       f           = (float)((par1 % 16) * 16 + 0) / 256F;
            float       f1          = (float)((par1 % 16) * 16 + 16) / 256F;
            float       f2          = (float)((par1 / 16) * 16 + 0) / 256F;
            float       f3          = (float)((par1 / 16) * 16 + 16) / 256F;
            float       f4          = 1.0F;
            float       f5          = 0.5F;
            float       f6          = 0.25F;

            for (int i = 0; i < par2; i++)
            {
                //GL.PushMatrix();

                if (i > 0)
                {
                    float f7 = (Random.NextFloat() * 2.0F - 1.0F) * 0.3F;
                    float f8 = (Random.NextFloat() * 2.0F - 1.0F) * 0.3F;
                    float f9 = (Random.NextFloat() * 2.0F - 1.0F) * 0.3F;
                    //GL.Translate(f7, f8, f9);
                }

                //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
                tessellator.StartDrawingQuads();
                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.PopMatrix();
            }
        }
        /// <summary>
        /// Renders the dragon, along with its dying animation
        /// </summary>
        public virtual void DoRenderDragon(EntityDragon par1EntityDragon, double par2, double par4, double par6, float par8, float par9)
        {
            EntityDragon = par1EntityDragon;

            if (Field_40284_d != 4)
            {
                MainModel     = new ModelDragon(0.0F);
                Field_40284_d = 4;
            }

            base.DoRenderLiving(par1EntityDragon, par2, par4, par6, par8, par9);

            if (par1EntityDragon.HealingEnderCrystal != null)
            {
                float f  = (float)par1EntityDragon.HealingEnderCrystal.InnerRotation + par9;
                float f1 = MathHelper2.Sin(f * 0.2F) / 2.0F + 0.5F;
                f1 = (f1 * f1 + f1) * 0.2F;
                float f2 = (float)(par1EntityDragon.HealingEnderCrystal.PosX - par1EntityDragon.PosX - (par1EntityDragon.PrevPosX - par1EntityDragon.PosX) * (double)(1.0F - par9));
                float f3 = (float)(((double)f1 + par1EntityDragon.HealingEnderCrystal.PosY) - 1.0D - par1EntityDragon.PosY - (par1EntityDragon.PrevPosY - par1EntityDragon.PosY) * (double)(1.0F - par9));
                float f4 = (float)(par1EntityDragon.HealingEnderCrystal.PosZ - par1EntityDragon.PosZ - (par1EntityDragon.PrevPosZ - par1EntityDragon.PosZ) * (double)(1.0F - par9));
                float f5 = MathHelper2.Sqrt_float(f2 * f2 + f4 * f4);
                float f6 = MathHelper2.Sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
                //GL.PushMatrix();
                //GL.Translate((float)par2, (float)par4 + 2.0F, (float)par6);
                //GL.Rotate(((float)(-Math.Atan2(f4, f2)) * 180F) / (float)Math.PI - 90F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(((float)(-Math.Atan2(f5, f3)) * 180F) / (float)Math.PI - 90F, 1.0F, 0.0F, 0.0F);
                Tessellator tessellator = Tessellator.Instance;
                RenderHelper.DisableStandardItemLighting();
                //GL.Disable(EnableCap.CullFace);
                LoadTexture("/mob/enderdragon/beam.png");
                //GL.ShadeModel(ShadingModel.Smooth);
                float f7 = 0.0F - ((float)par1EntityDragon.TicksExisted + par9) * 0.01F;
                float f8 = MathHelper2.Sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32F - ((float)par1EntityDragon.TicksExisted + par9) * 0.01F;
                tessellator.StartDrawing(5);
                int i = 8;

                for (int j = 0; j <= i; j++)
                {
                    float f9  = MathHelper2.Sin(((float)(j % i) * (float)Math.PI * 2.0F) / (float)i) * 0.75F;
                    float f10 = MathHelper2.Cos(((float)(j % i) * (float)Math.PI * 2.0F) / (float)i) * 0.75F;
                    float f11 = ((float)(j % i) * 1.0F) / (float)i;
                    tessellator.SetColorOpaque_I(0);
                    tessellator.AddVertexWithUV(f9 * 0.2F, f10 * 0.2F, 0.0F, f11, f8);
                    tessellator.SetColorOpaque_I(0xffffff);
                    tessellator.AddVertexWithUV(f9, f10, f6, f11, f7);
                }

                tessellator.Draw();
                //GL.Enable(EnableCap.CullFace);
                //GL.ShadeModel(ShadingModel.Flat);
                RenderHelper.EnableStandardItemLighting();
                //GL.PopMatrix();
            }
        }
예제 #10
0
        /// <summary>
        /// Adds a textured quad to the tesselator at the specified position with the specified texture coords, width and
        /// height.  Args: x, y, u, v, width, height
        /// </summary>
        public virtual void RenderTexturedQuad(int par1, int par2, int par3, int par4, int par5, int par6)
        {
            float       f           = 0.00390625F;
            float       f1          = 0.00390625F;
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(par1 + 0, par2 + par6, ZLevel, (float)(par3 + 0) * f, (float)(par4 + par6) * f1);
            tessellator.AddVertexWithUV(par1 + par5, par2 + par6, ZLevel, (float)(par3 + par5) * f, (float)(par4 + par6) * f1);
            tessellator.AddVertexWithUV(par1 + par5, par2 + 0, ZLevel, (float)(par3 + par5) * f, (float)(par4 + 0) * f1);
            tessellator.AddVertexWithUV(par1 + 0, par2 + 0, ZLevel, (float)(par3 + 0) * f, (float)(par4 + 0) * f1);
            tessellator.Draw();
        }
예제 #11
0
        /// <summary>
        /// Draws a sprite from /gui/slot.png.
        /// </summary>
        private void DrawSprite(int par1, int par2, int par3, int par4)
        {
            int i = Mc.RenderEngineOld.GetTexture("/gui/slot.png");

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(i);
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(par1 + 0, par2 + 18, ZLevel, (float)(par3 + 0) * 0.0078125F, (float)(par4 + 18) * 0.0078125F);
            tessellator.AddVertexWithUV(par1 + 18, par2 + 18, ZLevel, (float)(par3 + 18) * 0.0078125F, (float)(par4 + 18) * 0.0078125F);
            tessellator.AddVertexWithUV(par1 + 18, par2 + 0, ZLevel, (float)(par3 + 18) * 0.0078125F, (float)(par4 + 0) * 0.0078125F);
            tessellator.AddVertexWithUV(par1 + 0, par2 + 0, ZLevel, (float)(par3 + 0) * 0.0078125F, (float)(par4 + 0) * 0.0078125F);
            tessellator.Draw();
        }
        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();
        }
예제 #13
0
        public virtual void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f  = (float)(ParticleTextureIndex % 16) / 16F;
            float f1 = f + 0.0624375F;
            float f2 = (float)(ParticleTextureIndex / 16) / 16F;
            float f3 = f2 + 0.0624375F;
            float f4 = 0.1F * ParticleScale;
            float f5 = (float)((PrevPosX + (PosX - PrevPosX) * (double)par2) - InterpPosX);
            float f6 = (float)((PrevPosY + (PosY - PrevPosY) * (double)par2) - InterpPosY);
            float f7 = (float)((PrevPosZ + (PosZ - PrevPosZ) * (double)par2) - InterpPosZ);
            float f8 = 1.0F;

            par1Tessellator.SetColorOpaque_F(ParticleRed * f8, ParticleGreen * f8, ParticleBlue * f8);
            par1Tessellator.AddVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
            par1Tessellator.AddVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
            par1Tessellator.AddVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
            par1Tessellator.AddVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
        }
        private void Func_40265_a(Tessellator par1Tessellator, int par2)
        {
            float f  = (float)((par2 % 16) * 16 + 0) / 256F;
            float f1 = (float)((par2 % 16) * 16 + 16) / 256F;
            float f2 = (float)((par2 / 16) * 16 + 0) / 256F;
            float f3 = (float)((par2 / 16) * 16 + 16) / 256F;
            float f4 = 1.0F;
            float f5 = 0.5F;
            float f6 = 0.25F;

            //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(0.0F, 1.0F, 0.0F);
            par1Tessellator.AddVertexWithUV(0.0F - f5, 0.0F - f6, 0.0F, f, f3);
            par1Tessellator.AddVertexWithUV(f4 - f5, 0.0F - f6, 0.0F, f1, f3);
            par1Tessellator.AddVertexWithUV(f4 - f5, f4 - f6, 0.0F, f1, f2);
            par1Tessellator.AddVertexWithUV(0.0F - f5, f4 - f6, 0.0F, f, f2);
            par1Tessellator.Draw();
        }
예제 #15
0
        private void RenderPumpkinBlur(int par1, int par2)
        {
            //GL.Disable(EnableCap.DepthTest);
            //GL.DepthMask(false);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.AlphaTest);
            //GL.BindTexture(TextureTarget.Texture2D, mc.RenderEngineOld.GetTexture("%blur%/misc/pumpkinblur.png"));
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(0.0F, par2, -90D, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(par1, par2, -90D, 1.0D, 1.0D);
            tessellator.AddVertexWithUV(par1, 0.0F, -90D, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(0.0F, 0.0F, -90D, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.DepthMask(true);
            //GL.Enable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.AlphaTest);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
        }
예제 #16
0
        /// <summary>
        /// Renders the fire on the screen for first person mode. Arg: partialTickTime
        /// </summary>
        private void RenderFireInFirstPerson(float par1)
        {
            Tessellator tessellator = Tessellator.Instance;
            //GL.Color4(1.0F, 1.0F, 1.0F, 0.9F);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            float f = 1.0F;

            for (int i = 0; i < 2; i++)
            {
                //GL.PushMatrix();
                int   j  = Block.Fire.BlockIndexInTexture + i * 16;
                int   k  = (j & 0xf) << 4;
                int   l  = j & 0xf0;
                float f1 = (float)k / 256F;
                float f2 = ((float)k + 15.99F) / 256F;
                float f3 = (float)l / 256F;
                float f4 = ((float)l + 15.99F) / 256F;
                float f5 = (0.0F - f) / 2.0F;
                float f6 = f5 + f;
                float f7 = 0.0F - f / 2.0F;
                float f8 = f7 + f;
                float f9 = -0.5F;
                //GL.Translate((float)(-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F);
                //GL.Rotate((float)(i * 2 - 1) * 10F, 0.0F, 1.0F, 0.0F);
                tessellator.StartDrawingQuads();
                tessellator.AddVertexWithUV(f5, f7, f9, f2, f4);
                tessellator.AddVertexWithUV(f6, f7, f9, f1, f4);
                tessellator.AddVertexWithUV(f6, f8, f9, f1, f3);
                tessellator.AddVertexWithUV(f5, f8, f9, f2, f3);
                tessellator.Draw();
                //GL.PopMatrix();
            }

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.Blend);
        }
예제 #17
0
        /// <summary>
        /// Renders a shadow projected down onto the specified block. Brightness of the block plus how far away on the Y axis
        /// determines the alpha of the shadow.  Args: block, centerX, centerY, centerZ, blockX, blockY, blockZ, baseAlpha,
        /// shadowSize, xOffset, yOffset, zOffset
        /// </summary>
        private void RenderShadowOnBlock(Block par1Block, double par2, double par4, double par6, int par8, int par9, int par10, float par11, float par12, double par13, double par15, double par17)
        {
            Tessellator tessellator = Tessellator.Instance;

            if (!par1Block.RenderAsNormalBlock())
            {
                return;
            }

            double d = ((double)par11 - (par4 - ((double)par9 + par15)) / 2D) * 0.5D * (double)GetWorldFromRenderManager().GetLightBrightness(par8, par9, par10);

            if (d < 0.0F)
            {
                return;
            }

            if (d > 1.0D)
            {
                d = 1.0D;
            }

            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, (float)d);
            double d1 = (double)par8 + par1Block.MinX + par13;
            double d2 = (double)par8 + par1Block.MaxX + par13;
            double d3 = (double)par9 + par1Block.MinY + par15 + 0.015625D;
            double d4 = (double)par10 + par1Block.MinZ + par17;
            double d5 = (double)par10 + par1Block.MaxZ + par17;
            float  f  = (float)((par2 - d1) / 2D / (double)par12 + 0.5D);
            float  f1 = (float)((par2 - d2) / 2D / (double)par12 + 0.5D);
            float  f2 = (float)((par6 - d4) / 2D / (double)par12 + 0.5D);
            float  f3 = (float)((par6 - d5) / 2D / (double)par12 + 0.5D);

            tessellator.AddVertexWithUV(d1, d3, d4, f, f2);
            tessellator.AddVertexWithUV(d1, d3, d5, f, f3);
            tessellator.AddVertexWithUV(d2, d3, d5, f1, f3);
            tessellator.AddVertexWithUV(d2, d3, d4, f1, f2);
        }
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            int i = (int)((((float)Field_35130_a + par2) * 15F) / (float)Field_35129_ay);

            if (i > 15)
            {
                return;
            }
            else
            {
                Field_35128_az.BindTexture("misc.explosion.png");
                float f  = (float)(i % 4) / 4F;
                float f1 = f + 0.24975F;
                float f2 = (float)(i / 4) / 4F;
                float f3 = f2 + 0.24975F;
                float f4 = 2.0F * Field_35131_aA;
                float f5 = (float)((PrevPosX + (PosX - PrevPosX) * (double)par2) - InterpPosX);
                float f6 = (float)((PrevPosY + (PosY - PrevPosY) * (double)par2) - InterpPosY);
                float f7 = (float)((PrevPosZ + (PosZ - PrevPosZ) * (double)par2) - InterpPosZ);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Disable(EnableCap.Lighting);
                RenderHelper.DisableStandardItemLighting();
                par1Tessellator.StartDrawingQuads();
                par1Tessellator.SetColorRGBA_F(ParticleRed, ParticleGreen, ParticleBlue, 1.0F);
                par1Tessellator.SetNormal(0.0F, 1.0F, 0.0F);
                par1Tessellator.SetBrightness(240);
                par1Tessellator.AddVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
                par1Tessellator.AddVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
                par1Tessellator.AddVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
                par1Tessellator.AddVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
                par1Tessellator.Draw();
                //GL.PolygonOffset(0.0F, 0.0F);
                //GL.Enable(EnableCap.Lighting);
                return;
            }
        }
예제 #19
0
        /// <summary>
        /// Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
        /// </summary>
        private void RenderEntityOnFire(Entity par1Entity, double par2, double par4, double par6, float par8)
        {
            //GL.Disable(EnableCap.Lighting);
            int   i  = Block.Fire.BlockIndexInTexture;
            int   j  = (i & 0xf) << 4;
            int   k  = i & 0xf0;
            float f  = (float)j / 256F;
            float f2 = ((float)j + 15.99F) / 256F;
            float f4 = (float)k / 256F;
            float f6 = ((float)k + 15.99F) / 256F;
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            float f8 = par1Entity.Width * 1.4F;

            //GL.Scale(f8, f8, f8);
            LoadTexture("terrain.png");
            Tessellator tessellator = Tessellator.Instance;
            float       f9          = 0.5F;
            float       f10         = 0.0F;
            float       f11         = par1Entity.Height / f8;
            float       f12         = (float)(par1Entity.PosY - par1Entity.BoundingBox.MinY);
            //GL.Rotate(-RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Translate(0.0F, 0.0F, -0.3F + (float)(int)f11 * 0.02F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            float f13 = 0.0F;
            int   l   = 0;

            tessellator.StartDrawingQuads();

            while (f11 > 0.0F)
            {
                float f1;
                float f3;
                float f5;
                float f7;

                if (l % 2 == 0)
                {
                    f1 = (float)j / 256F;
                    f3 = ((float)j + 15.99F) / 256F;
                    f5 = (float)k / 256F;
                    f7 = ((float)k + 15.99F) / 256F;
                }
                else
                {
                    f1 = (float)j / 256F;
                    f3 = ((float)j + 15.99F) / 256F;
                    f5 = (float)(k + 16) / 256F;
                    f7 = ((float)(k + 16) + 15.99F) / 256F;
                }

                if ((l / 2) % 2 == 0)
                {
                    float f14 = f3;
                    f3 = f1;
                    f1 = f14;
                }

                tessellator.AddVertexWithUV(f9 - f10, 0.0F - f12, f13, f3, f7);
                tessellator.AddVertexWithUV(-f9 - f10, 0.0F - f12, f13, f1, f7);
                tessellator.AddVertexWithUV(-f9 - f10, 1.4F - f12, f13, f1, f5);
                tessellator.AddVertexWithUV(f9 - f10, 1.4F - f12, f13, f3, f5);
                f11 -= 0.45F;
                f12 -= 0.45F;
                f9  *= 0.9F;
                f13 += 0.03F;
                l++;
            }

            tessellator.Draw();
            //GL.PopMatrix();
            //GL.Enable(EnableCap.Lighting);
        }
        public virtual void DoRenderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
        {
            LoadTexture("/item/arrows.png");
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            //GL.Rotate((par1EntityArrow.PrevRotationYaw + (par1EntityArrow.RotationYaw - par1EntityArrow.PrevRotationYaw) * par9) - 90F, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(par1EntityArrow.PrevRotationPitch + (par1EntityArrow.RotationPitch - par1EntityArrow.PrevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
            Tessellator tessellator = Tessellator.Instance;
            int         i           = 0;
            float       f           = 0.0F;
            float       f1          = 0.5F;
            float       f2          = (float)(0 + i * 10) / 32F;
            float       f3          = (float)(5 + i * 10) / 32F;
            float       f4          = 0.0F;
            float       f5          = 0.15625F;
            float       f6          = (float)(5 + i * 10) / 32F;
            float       f7          = (float)(10 + i * 10) / 32F;
            float       f8          = 0.05625F;
            //GL.Enable(EnableCap.RescaleNormal);
            float f9 = (float)par1EntityArrow.ArrowShake - par9;

            if (f9 > 0.0F)
            {
                float f10 = -MathHelper2.Sin(f9 * 3F) * f9;
                //GL.Rotate(f10, 0.0F, 0.0F, 1.0F);
            }

            //GL.Rotate(45F, 1.0F, 0.0F, 0.0F);
            //GL.Scale(f8, f8, f8);
            //GL.Translate(-4F, 0.0F, 0.0F);
            //GL.Normal3(f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f7);
            tessellator.Draw();
            //GL.Normal3(-f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f7);
            tessellator.Draw();

            for (int j = 0; j < 4; j++)
            {
                //GL.Rotate(90F, 1.0F, 0.0F, 0.0F);
                //GL.Normal3(0.0F, 0.0F, f8);
                tessellator.StartDrawingQuads();
                tessellator.AddVertexWithUV(-8D, -2D, 0.0F, f, f2);
                tessellator.AddVertexWithUV(8D, -2D, 0.0F, f1, f2);
                tessellator.AddVertexWithUV(8D, 2D, 0.0F, f1, f3);
                tessellator.AddVertexWithUV(-8D, 2D, 0.0F, f, f3);
                tessellator.Draw();
            }

            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
예제 #21
0
        /// <summary>
        /// Actually renders the fishing line and hook
        /// </summary>
        public virtual void DoRenderFishHook(EntityFishHook par1EntityFishHook, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            //GL.Enable(EnableCap.RescaleNormal);
            //GL.Scale(0.5F, 0.5F, 0.5F);
            int   i     = 1;
            sbyte byte0 = 2;

            LoadTexture("/particles.png");
            Tessellator tessellator = Tessellator.Instance;
            float       f           = (float)(i * 8 + 0) / 128F;
            float       f1          = (float)(i * 8 + 8) / 128F;
            float       f2          = (float)(byte0 * 8 + 0) / 128F;
            float       f3          = (float)(byte0 * 8 + 8) / 128F;
            float       f4          = 1.0F;
            float       f5          = 0.5F;
            float       f6          = 0.5F;

            //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            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.RescaleNormal);
            //GL.PopMatrix();

            if (par1EntityFishHook.Angler != null)
            {
                float  f7    = ((par1EntityFishHook.Angler.PrevRotationYaw + (par1EntityFishHook.Angler.RotationYaw - par1EntityFishHook.Angler.PrevRotationYaw) * par9) * (float)Math.PI) / 180F;
                double d     = MathHelper2.Sin(f7);
                double d2    = MathHelper2.Cos(f7);
                float  f9    = par1EntityFishHook.Angler.GetSwingProgress(par9);
                float  f10   = MathHelper2.Sin(MathHelper2.Sqrt_float(f9) * (float)Math.PI);
                Vec3D  vec3d = Vec3D.CreateVector(-0.5D, 0.029999999999999999D, 0.80000000000000004D);
                vec3d.RotateAroundX((-(par1EntityFishHook.Angler.PrevRotationPitch + (par1EntityFishHook.Angler.RotationPitch - par1EntityFishHook.Angler.PrevRotationPitch) * par9) * (float)Math.PI) / 180F);
                vec3d.RotateAroundY((-(par1EntityFishHook.Angler.PrevRotationYaw + (par1EntityFishHook.Angler.RotationYaw - par1EntityFishHook.Angler.PrevRotationYaw) * par9) * (float)Math.PI) / 180F);
                vec3d.RotateAroundY(f10 * 0.5F);
                vec3d.RotateAroundX(-f10 * 0.7F);
                double d4 = par1EntityFishHook.Angler.PrevPosX + (par1EntityFishHook.Angler.PosX - par1EntityFishHook.Angler.PrevPosX) * (double)par9 + vec3d.XCoord;
                double d5 = par1EntityFishHook.Angler.PrevPosY + (par1EntityFishHook.Angler.PosY - par1EntityFishHook.Angler.PrevPosY) * (double)par9 + vec3d.YCoord;
                double d6 = par1EntityFishHook.Angler.PrevPosZ + (par1EntityFishHook.Angler.PosZ - par1EntityFishHook.Angler.PrevPosZ) * (double)par9 + vec3d.ZCoord;

                if (RenderManager.Options.ThirdPersonView > 0)
                {
                    float  f8 = ((par1EntityFishHook.Angler.PrevRenderYawOffset + (par1EntityFishHook.Angler.RenderYawOffset - par1EntityFishHook.Angler.PrevRenderYawOffset) * par9) * (float)Math.PI) / 180F;
                    double d1 = MathHelper2.Sin(f8);
                    double d3 = MathHelper2.Cos(f8);
                    d4 = (par1EntityFishHook.Angler.PrevPosX + (par1EntityFishHook.Angler.PosX - par1EntityFishHook.Angler.PrevPosX) * (double)par9) - d3 * 0.34999999999999998D - d1 * 0.84999999999999998D;
                    d5 = (par1EntityFishHook.Angler.PrevPosY + (par1EntityFishHook.Angler.PosY - par1EntityFishHook.Angler.PrevPosY) * (double)par9) - 0.45000000000000001D;
                    d6 = ((par1EntityFishHook.Angler.PrevPosZ + (par1EntityFishHook.Angler.PosZ - par1EntityFishHook.Angler.PrevPosZ) * (double)par9) - d1 * 0.34999999999999998D) + d3 * 0.84999999999999998D;
                }

                double d7  = par1EntityFishHook.PrevPosX + (par1EntityFishHook.PosX - par1EntityFishHook.PrevPosX) * (double)par9;
                double d8  = par1EntityFishHook.PrevPosY + (par1EntityFishHook.PosY - par1EntityFishHook.PrevPosY) * (double)par9 + 0.25D;
                double d9  = par1EntityFishHook.PrevPosZ + (par1EntityFishHook.PosZ - par1EntityFishHook.PrevPosZ) * (double)par9;
                double d10 = (float)(d4 - d7);
                double d11 = (float)(d5 - d8);
                double d12 = (float)(d6 - d9);
                //GL.Disable(EnableCap.Texture2D);
                //GL.Disable(EnableCap.Lighting);
                tessellator.StartDrawing(3);
                tessellator.SetColorOpaque_I(0);
                int j = 16;

                for (int k = 0; k <= j; k++)
                {
                    float f11 = (float)k / (float)j;
                    tessellator.AddVertex(par2 + d10 * (double)f11, par4 + d11 * (double)(f11 * f11 + f11) * 0.5D + 0.25D, par6 + d12 * (double)f11);
                }

                tessellator.Draw();
                //GL.Enable(EnableCap.Lighting);
                //GL.Enable(EnableCap.Texture2D);
            }
        }
예제 #22
0
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            Func_41040_b(par1, par2, par3);
            Tessellator tessellator = Tessellator.Instance;
            int         c           = 274;
            int         i           = Width / 2 - c / 2;
            int         j           = Height + 50;
            float       f           = -((float)UpdateCounter + par3) * Field_41043_e;

            //GL.PushMatrix();
            //GL.Translate(0.0F, f, 0.0F);
            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/title/mclogo.png"));
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            DrawTexturedModalRect(i, j, 0, 0, 155, 44);
            DrawTexturedModalRect(i + 155, j, 0, 45, 155, 44);
            tessellator.SetColorOpaque_I(0xffffff);
            int k = j + 200;

            for (int l = 0; l < Lines.Count; l++)
            {
                if (l == Lines.Count - 1)
                {
                    float f1 = ((float)k + f) - (float)(Height / 2 - 6);

                    if (f1 < 0.0F)
                    {
                        //GL.Translate(0.0F, -f1, 0.0F);
                    }
                }

                if ((float)k + f + 12F + 8F > 0.0F && (float)k + f < (float)Height)
                {
                    string s = (string)Lines[l];

                    if (s.StartsWith("[C]"))
                    {
                        FontRenderer.DrawStringWithShadow(s.Substring(3), i + (c - (int)FontRenderer.GetStringWidth(s.Substring(3))) / 2, k, 0xffffff);
                    }
                    else
                    {
                        FontRenderer.FontRandom.SetSeed((int)l * (int)0xfca9953 + (UpdateCounter / 4));
                        FontRenderer.Func_50101_a(s, i + 1, k + 1, 0xffffff, true);
                        FontRenderer.FontRandom.SetSeed((int)l * (int)0xfca9953 + (UpdateCounter / 4));
                        FontRenderer.Func_50101_a(s, i, k, 0xffffff, false);
                    }
                }

                k += 12;
            }

            //GL.PopMatrix();
            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("%blur%/misc/vignette.png"));
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.Zero, BlendingFactorDest.OneMinusSrcColor);
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
            int i1 = Width;
            int j1 = Height;

            tessellator.AddVertexWithUV(0.0F, j1, ZLevel, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(i1, j1, ZLevel, 1.0D, 1.0D);
            tessellator.AddVertexWithUV(i1, 0.0F, ZLevel, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(0.0F, 0.0F, ZLevel, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            base.DrawScreen(par1, par2, par3);
        }
예제 #23
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);
        }
예제 #24
0
        /// <summary>
        /// Renders the active item in the player's hand when in first person mode. Args: partialTickTime
        /// </summary>
        public virtual void RenderItemInFirstPerson(float par1)
        {
            float          f = PrevEquippedProgress + (EquippedProgress - PrevEquippedProgress) * par1;
            EntityPlayerSP entityplayersp = Mc.ThePlayer;
            float          f1             = ((EntityPlayer)(entityplayersp)).PrevRotationPitch + (((EntityPlayer)(entityplayersp)).RotationPitch - ((EntityPlayer)(entityplayersp)).PrevRotationPitch) * par1;

            //GL.PushMatrix();
            //GL.Rotate(f1, 1.0F, 0.0F, 0.0F);
            //GL.Rotate(((EntityPlayer)(entityplayersp)).PrevRotationYaw + (((EntityPlayer)(entityplayersp)).RotationYaw - ((EntityPlayer)(entityplayersp)).PrevRotationYaw) * par1, 0.0F, 1.0F, 0.0F);
            RenderHelper.EnableStandardItemLighting();
            //GL.PopMatrix();

            if (entityplayersp is EntityPlayerSP)
            {
                EntityPlayerSP entityplayersp1 = (EntityPlayerSP)entityplayersp;
                float          f2 = entityplayersp1.PrevRenderArmPitch + (entityplayersp1.RenderArmPitch - entityplayersp1.PrevRenderArmPitch) * par1;
                float          f4 = entityplayersp1.PrevRenderArmYaw + (entityplayersp1.RenderArmYaw - entityplayersp1.PrevRenderArmYaw) * par1;
                //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationPitch - f2) * 0.1F, 1.0F, 0.0F, 0.0F);
                //GL.Rotate((((EntityPlayer)(entityplayersp)).RotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
            }

            ItemStack itemstack = ItemToRender;
            float     f3        = Mc.TheWorld.GetLightBrightness(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ));

            f3 = 1.0F;
            int i = Mc.TheWorld.GetLightBrightnessForSkyBlocks(MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosX), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosY), MathHelper2.Floor_double(((EntityPlayer)(entityplayersp)).PosZ), 0);
            int k = i % 0x10000;
            int l = i / 0x10000;

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

            if (itemstack != null)
            {
                int   j   = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 0);
                float f8  = (float)(j >> 16 & 0xff) / 255F;
                float f13 = (float)(j >> 8 & 0xff) / 255F;
                float f19 = (float)(j & 0xff) / 255F;
                //GL.Color4(f3 * f8, f3 * f13, f3 * f19, 1.0F);
            }
            else
            {
                //GL.Color4(f3, f3, f3, 1.0F);
            }

            if (itemstack != null && itemstack.ItemID == Item.Map.ShiftedIndex)
            {
                //GL.PushMatrix();
                //	float f5 = 0.8F;
                float f9  = entityplayersp.GetSwingProgress(par1);
                float f14 = MathHelper2.Sin(f9 * (float)Math.PI);
                float f20 = MathHelper2.Sin(MathHelper2.Sqrt_float(f9) * (float)Math.PI);
                //GL.Translate(-f20 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f9) * (float)Math.PI * 2.0F) * 0.2F, -f14 * 0.2F);
                f9 = (1.0F - f1 / 45F) + 0.1F;

                if (f9 < 0.0F)
                {
                    f9 = 0.0F;
                }

                if (f9 > 1.0F)
                {
                    f9 = 1.0F;
                }

                f9 = -MathHelper2.Cos(f9 * (float)Math.PI) * 0.5F + 0.5F;
                //GL.Translate(0.0F, (0.0F * f5 - (1.0F - f) * 1.2F - f9 * 0.5F) + 0.04F, -0.9F * f5);
                //GL.Rotate(90F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(f9 * -85F, 0.0F, 0.0F, 1.0F);
                //GL.Enable(EnableCap.RescaleNormal);
                //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture()));

                for (f14 = 0; f14 < 2; f14++)
                {
                    f20 = f14 * 2 - 1;
                    //GL.PushMatrix();
                    //GL.Translate(-0F, -0.6F, 1.1F * (float)f20);
                    //GL.Rotate(-45 * f20, 1.0F, 0.0F, 0.0F);
                    //GL.Rotate(-90F, 0.0F, 0.0F, 1.0F);
                    //GL.Rotate(59F, 0.0F, 0.0F, 1.0F);
                    //GL.Rotate(-65 * f20, 0.0F, 1.0F, 0.0F);
                    Render       render1       = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer);
                    RenderPlayer renderplayer1 = (RenderPlayer)render1;
                    //	float f34 = 1.0F;
                    //GL.Scale(f34, f34, f34);
                    renderplayer1.DrawFirstPersonHand();
                    //GL.PopMatrix();
                }

                f14 = entityplayersp.GetSwingProgress(par1);
                f20 = MathHelper2.Sin(f14 * f14 * (float)Math.PI);
                float f27 = MathHelper2.Sin(MathHelper2.Sqrt_float(f14) * (float)Math.PI);
                //GL.Rotate(-f20 * 20F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(-f27 * 20F, 0.0F, 0.0F, 1.0F);
                //GL.Rotate(-f27 * 80F, 1.0F, 0.0F, 0.0F);
                f14 = 0.38F;
                //GL.Scale(f14, f14, f14);
                //GL.Rotate(90F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(180F, 0.0F, 0.0F, 1.0F);
                //GL.Translate(-1F, -1F, 0.0F);
                f20 = 0.015625F;
                //GL.Scale(f20, f20, f20);
                Mc.RenderEngineOld.BindTexture(Mc.RenderEngineOld.GetTexture("/misc/mapbg.png"));
                Tessellator tessellator = Tessellator.Instance;
                //GL.Normal3(0.0F, 0.0F, -1F);
                tessellator.StartDrawingQuads();
                sbyte byte0 = 7;
                tessellator.AddVertexWithUV(0 - byte0, 128 + byte0, 0.0F, 0.0F, 1.0D);
                tessellator.AddVertexWithUV(128 + byte0, 128 + byte0, 0.0F, 1.0D, 1.0D);
                tessellator.AddVertexWithUV(128 + byte0, 0 - byte0, 0.0F, 1.0D, 0.0F);
                tessellator.AddVertexWithUV(0 - byte0, 0 - byte0, 0.0F, 0.0F, 0.0F);
                tessellator.Draw();
                MapData mapdata = Item.Map.GetMapData(itemstack, Mc.TheWorld);
                MapItemRenderer.RenderMap(Mc.ThePlayer, Mc.RenderEngineOld, mapdata);
                //GL.PopMatrix();
            }
            else if (itemstack != null)
            {
                //GL.PushMatrix();
                //	float f6 = 0.8F;

                if (entityplayersp.GetItemInUseCount() > 0)
                {
                    EnumAction enumaction = itemstack.GetItemUseAction();

                    if (enumaction == EnumAction.Eat || enumaction == EnumAction.Drink)
                    {
                        float f15 = ((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F;
                        float f21 = 1.0F - f15 / (float)itemstack.GetMaxItemUseDuration();
                        float f28 = f21;
                        float f31 = 1.0F - f28;
                        f31 = f31 * f31 * f31;
                        f31 = f31 * f31 * f31;
                        f31 = f31 * f31 * f31;
                        float f35 = 1.0F - f31;
                        //GL.Translate(0.0F, MathHelper.Abs(MathHelper.Cos((f15 / 4F) * (float)Math.PI) * 0.1F) * (float)((double)f28 <= 0.20000000000000001D ? 0 : 1), 0.0F);
                        //GL.Translate(f35 * 0.6F, -f35 * 0.5F, 0.0F);
                        //GL.Rotate(f35 * 90F, 0.0F, 1.0F, 0.0F);
                        //GL.Rotate(f35 * 10F, 1.0F, 0.0F, 0.0F);
                        //GL.Rotate(f35 * 30F, 0.0F, 0.0F, 1.0F);
                    }
                }
                else
                {
                    float f10 = entityplayersp.GetSwingProgress(par1);
                    float f16 = MathHelper2.Sin(f10 * (float)Math.PI);
                    float f22 = MathHelper2.Sin(MathHelper2.Sqrt_float(f10) * (float)Math.PI);
                    //GL.Translate(-f22 * 0.4F, MathHelper.Sin(MathHelper.Sqrt_float(f10) * (float)Math.PI * 2.0F) * 0.2F, -f16 * 0.2F);
                }

                //GL.Translate(0.7F * f6, -0.65F * f6 - (1.0F - f) * 0.6F, -0.9F * f6);
                //GL.Rotate(45F, 0.0F, 1.0F, 0.0F);
                //GL.Enable(EnableCap.RescaleNormal);
                float f11 = entityplayersp.GetSwingProgress(par1);
                float f17 = MathHelper2.Sin(f11 * f11 * (float)Math.PI);
                float f23 = MathHelper2.Sin(MathHelper2.Sqrt_float(f11) * (float)Math.PI);
                //GL.Rotate(-f17 * 20F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(-f23 * 20F, 0.0F, 0.0F, 1.0F);
                //GL.Rotate(-f23 * 80F, 1.0F, 0.0F, 0.0F);
                f11 = 0.4F;
                //GL.Scale(f11, f11, f11);

                if (entityplayersp.GetItemInUseCount() > 0)
                {
                    EnumAction enumaction1 = itemstack.GetItemUseAction();

                    if (enumaction1 == EnumAction.Block)
                    {
                        //GL.Translate(-0.5F, 0.2F, 0.0F);
                        //GL.Rotate(30F, 0.0F, 1.0F, 0.0F);
                        //GL.Rotate(-80F, 1.0F, 0.0F, 0.0F);
                        //GL.Rotate(60F, 0.0F, 1.0F, 0.0F);
                    }
                    else if (enumaction1 == EnumAction.Bow)
                    {
                        //GL.Rotate(-18F, 0.0F, 0.0F, 1.0F);
                        //GL.Rotate(-12F, 0.0F, 1.0F, 0.0F);
                        //GL.Rotate(-8F, 1.0F, 0.0F, 0.0F);
                        //GL.Translate(-0.9F, 0.2F, 0.0F);
                        float f24 = (float)itemstack.GetMaxItemUseDuration() - (((float)entityplayersp.GetItemInUseCount() - par1) + 1.0F);
                        float f29 = f24 / 20F;
                        f29 = (f29 * f29 + f29 * 2.0F) / 3F;

                        if (f29 > 1.0F)
                        {
                            f29 = 1.0F;
                        }

                        if (f29 > 0.1F)
                        {
                            //GL.Translate(0.0F, MathHelper.Sin((f24 - 0.1F) * 1.3F) * 0.01F * (f29 - 0.1F), 0.0F);
                        }

                        //GL.Translate(0.0F, 0.0F, f29 * 0.1F);
                        //GL.Rotate(-335F, 0.0F, 0.0F, 1.0F);
                        //GL.Rotate(-50F, 0.0F, 1.0F, 0.0F);
                        //GL.Translate(0.0F, 0.5F, 0.0F);
                        float f32 = 1.0F + f29 * 0.2F;
                        //GL.Scale(1.0F, 1.0F, f32);
                        //GL.Translate(0.0F, -0.5F, 0.0F);
                        //GL.Rotate(50F, 0.0F, 1.0F, 0.0F);
                        //GL.Rotate(335F, 0.0F, 0.0F, 1.0F);
                    }
                }

                if (itemstack.GetItem().ShouldRotateAroundWhenRendering())
                {
                    //GL.Rotate(180F, 0.0F, 1.0F, 0.0F);
                }

                if (itemstack.GetItem().Func_46058_c())
                {
                    RenderItem(entityplayersp, itemstack, 0);
                    int   i1  = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 1);
                    float f25 = (float)(i1 >> 16 & 0xff) / 255F;
                    float f30 = (float)(i1 >> 8 & 0xff) / 255F;
                    float f33 = (float)(i1 & 0xff) / 255F;
                    //GL.Color4(f3 * f25, f3 * f30, f3 * f33, 1.0F);
                    RenderItem(entityplayersp, itemstack, 1);
                }
                else
                {
                    RenderItem(entityplayersp, itemstack, 0);
                }

                //GL.PopMatrix();
            }
            else
            {
                //GL.PushMatrix();
                //	float f7 = 0.8F;
                float f12 = entityplayersp.GetSwingProgress(par1);
                float f18 = MathHelper2.Sin(f12 * (float)Math.PI);
                float f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI);
                //GL.Translate(-f26 * 0.3F, MathHelper.Sin(MathHelper.Sqrt_float(f12) * (float)Math.PI * 2.0F) * 0.4F, -f18 * 0.4F);
                //GL.Translate(0.8F * f7, -0.75F * f7 - (1.0F - f) * 0.6F, -0.9F * f7);
                //GL.Rotate(45F, 0.0F, 1.0F, 0.0F);
                //GL.Enable(EnableCap.RescaleNormal);
                f12 = entityplayersp.GetSwingProgress(par1);
                f18 = MathHelper2.Sin(f12 * f12 * (float)Math.PI);
                f26 = MathHelper2.Sin(MathHelper2.Sqrt_float(f12) * (float)Math.PI);
                //GL.Rotate(f26 * 70F, 0.0F, 1.0F, 0.0F);
                //GL.Rotate(-f18 * 20F, 0.0F, 0.0F, 1.0F);
                //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTextureForDownloadableImage(Mc.ThePlayer.SkinUrl, Mc.ThePlayer.GetTexture()));
                //GL.Translate(-1F, 3.6F, 3.5F);
                //GL.Rotate(120F, 0.0F, 0.0F, 1.0F);
                //GL.Rotate(200F, 1.0F, 0.0F, 0.0F);
                //GL.Rotate(-135F, 0.0F, 1.0F, 0.0F);
                //GL.Scale(1.0F, 1.0F, 1.0F);
                //GL.Translate(5.6F, 0.0F, 0.0F);
                Render       render       = RenderManager.Instance.GetEntityRenderObject(Mc.ThePlayer);
                RenderPlayer renderplayer = (RenderPlayer)render;
                f26 = 1.0F;
                //GL.Scale(f26, f26, f26);
                renderplayer.DrawFirstPersonHand();
                //GL.PopMatrix();
            }

            //GL.Disable(EnableCap.RescaleNormal);
            RenderHelper.DisableStandardItemLighting();
        }
예제 #25
0
        /// <summary>
        /// Renders an item held in hand as a 2D texture with thickness
        /// </summary>
        private void RenderItemIn2D(Tessellator par1Tessellator, float par2, float par3, float par4, float par5)
        {
            float f  = 1.0F;
            float f1 = 0.0625F;

            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(0.0F, 0.0F, 1.0F);
            par1Tessellator.AddVertexWithUV(0.0F, 0.0F, 0.0F, par2, par5);
            par1Tessellator.AddVertexWithUV(f, 0.0F, 0.0F, par4, par5);
            par1Tessellator.AddVertexWithUV(f, 1.0D, 0.0F, par4, par3);
            par1Tessellator.AddVertexWithUV(0.0F, 1.0D, 0.0F, par2, par3);
            par1Tessellator.Draw();
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(0.0F, 0.0F, -1F);
            par1Tessellator.AddVertexWithUV(0.0F, 1.0D, 0.0F - f1, par2, par3);
            par1Tessellator.AddVertexWithUV(f, 1.0D, 0.0F - f1, par4, par3);
            par1Tessellator.AddVertexWithUV(f, 0.0F, 0.0F - f1, par4, par5);
            par1Tessellator.AddVertexWithUV(0.0F, 0.0F, 0.0F - f1, par2, par5);
            par1Tessellator.Draw();
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(-1F, 0.0F, 0.0F);

            for (int i = 0; i < 16; i++)
            {
                float f2  = (float)i / 16F;
                float f6  = (par2 + (par4 - par2) * f2) - 0.001953125F;
                float f10 = f * f2;
                par1Tessellator.AddVertexWithUV(f10, 0.0F, 0.0F - f1, f6, par5);
                par1Tessellator.AddVertexWithUV(f10, 0.0F, 0.0F, f6, par5);
                par1Tessellator.AddVertexWithUV(f10, 1.0D, 0.0F, f6, par3);
                par1Tessellator.AddVertexWithUV(f10, 1.0D, 0.0F - f1, f6, par3);
            }

            par1Tessellator.Draw();
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(1.0F, 0.0F, 0.0F);

            for (int j = 0; j < 16; j++)
            {
                float f3  = (float)j / 16F;
                float f7  = (par2 + (par4 - par2) * f3) - 0.001953125F;
                float f11 = f * f3 + 0.0625F;
                par1Tessellator.AddVertexWithUV(f11, 1.0D, 0.0F - f1, f7, par3);
                par1Tessellator.AddVertexWithUV(f11, 1.0D, 0.0F, f7, par3);
                par1Tessellator.AddVertexWithUV(f11, 0.0F, 0.0F, f7, par5);
                par1Tessellator.AddVertexWithUV(f11, 0.0F, 0.0F - f1, f7, par5);
            }

            par1Tessellator.Draw();
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(0.0F, 1.0F, 0.0F);

            for (int k = 0; k < 16; k++)
            {
                float f4  = (float)k / 16F;
                float f8  = (par5 + (par3 - par5) * f4) - 0.001953125F;
                float f12 = f * f4 + 0.0625F;
                par1Tessellator.AddVertexWithUV(0.0F, f12, 0.0F, par2, f8);
                par1Tessellator.AddVertexWithUV(f, f12, 0.0F, par4, f8);
                par1Tessellator.AddVertexWithUV(f, f12, 0.0F - f1, par4, f8);
                par1Tessellator.AddVertexWithUV(0.0F, f12, 0.0F - f1, par2, f8);
            }

            par1Tessellator.Draw();
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetNormal(0.0F, -1F, 0.0F);

            for (int l = 0; l < 16; l++)
            {
                float f5  = (float)l / 16F;
                float f9  = (par5 + (par3 - par5) * f5) - 0.001953125F;
                float f13 = f * f5;
                par1Tessellator.AddVertexWithUV(f, f13, 0.0F, par4, f9);
                par1Tessellator.AddVertexWithUV(0.0F, f13, 0.0F, par2, f9);
                par1Tessellator.AddVertexWithUV(0.0F, f13, 0.0F - f1, par2, f9);
                par1Tessellator.AddVertexWithUV(f, f13, 0.0F - f1, par4, f9);
            }

            par1Tessellator.Draw();
        }
예제 #26
0
        public virtual void RenderMap(EntityPlayer par1EntityPlayer, RenderEngineOld par2RenderEngine, MapData par3MapData)
        {
            for (int i = 0; i < 16384; i++)
            {
                byte byte0 = par3MapData.Colors[i];

                if (byte0 / 4 == 0)
                {
                    intArray[i] = (i + i / 128 & 1) * 8 + 16 << 24;
                    continue;
                }

                int l  = MapColor.MapColorArray[byte0 / 4].ColorValue;
                int i1 = byte0 & 3;
                int c  = 334;

                if (i1 == 2)
                {
                    c = 377;
                }

                if (i1 == 0)
                {
                    c = 264;
                }

                int j1 = ((l >> 16 & 0xff) * c) / 255;
                int k1 = ((l >> 8 & 0xff) * c) / 255;
                int l1 = ((l & 0xff) * c) / 255;

                if (gameSettings.Anaglyph)
                {
                    int i2 = (j1 * 30 + k1 * 59 + l1 * 11) / 100;
                    int j2 = (j1 * 30 + k1 * 70) / 100;
                    int k2 = (j1 * 30 + l1 * 70) / 100;
                    j1 = i2;
                    k1 = j2;
                    l1 = k2;
                }

                intArray[i] = 0xff00000 | j1 << 16 | k1 << 8 | l1;
            }

            par2RenderEngine.CreateTextureFromBytes(intArray, 128, 128, bufferedImage);
            int         j           = 0;
            int         k           = 0;
            Tessellator tessellator = Tessellator.Instance;
            float       f           = 0.0F;

            //GL.BindTexture(TextureTarget.Texture2D, bufferedImage);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.Disable(EnableCap.AlphaTest);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV((float)(j + 0) + f, (float)(k + 128) - f, -0.0099999997764825821D, 0.0F, 1.0D);
            tessellator.AddVertexWithUV((float)(j + 128) - f, (float)(k + 128) - f, -0.0099999997764825821D, 1.0D, 1.0D);
            tessellator.AddVertexWithUV((float)(j + 128) - f, (float)(k + 0) + f, -0.0099999997764825821D, 1.0D, 0.0F);
            tessellator.AddVertexWithUV((float)(j + 0) + f, (float)(k + 0) + f, -0.0099999997764825821D, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.Enable(EnableCap.AlphaTest);
            //GL.Disable(EnableCap.Blend);
            par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("/misc/mapicons.png"));

            /*
             * for (IEnumerator<MapCoord> iterator = par3MapData.PlayersVisibleOnMap.GetEnumerator(); iterator.MoveNext(); GL.PopMatrix())
             * {
             *  MapCoord mapcoord = iterator.Current;
             *  GL.PushMatrix();
             *  GL.Translate((float)j + (float)mapcoord.CenterX / 2.0F + 64F, (float)k + (float)mapcoord.CenterZ / 2.0F + 64F, -0.02F);
             *  GL.Rotate((float)(mapcoord.IconRotation * 360) / 16F, 0.0F, 0.0F, 1.0F);
             *  GL.Scale(4F, 4F, 3F);
             *  GL.Translate(-0.125F, 0.125F, 0.0F);
             *  float f1 = (float)(mapcoord.Field_28217_a % 4 + 0) / 4F;
             *  float f2 = (float)(mapcoord.Field_28217_a / 4 + 0) / 4F;
             *  float f3 = (float)(mapcoord.Field_28217_a % 4 + 1) / 4F;
             *  float f4 = (float)(mapcoord.Field_28217_a / 4 + 1) / 4F;
             *  tessellator.StartDrawingQuads();
             *  tessellator.AddVertexWithUV(-1D, 1.0D, 0.0F, f1, f2);
             *  tessellator.AddVertexWithUV(1.0D, 1.0D, 0.0F, f3, f2);
             *  tessellator.AddVertexWithUV(1.0D, -1D, 0.0F, f3, f4);
             *  tessellator.AddVertexWithUV(-1D, -1D, 0.0F, f1, f4);
             *  tessellator.Draw();
             * }
             */
            //GL.PushMatrix();
            //GL.Translate(0.0F, 0.0F, -0.04F);
            //GL.Scale(1.0F, 1.0F, 1.0F);
            fontRenderer.DrawString(par3MapData.MapName, j, k, 0xff00000);
            //GL.PopMatrix();
        }
        private void Func_159_a(EntityPainting par1EntityPainting, int par2, int par3, int par4, int par5)
        {
            float f  = (float)(-par2) / 2.0F;
            float f1 = (float)(-par3) / 2.0F;
            float f2 = -0.5F;
            float f3 = 0.5F;

            for (int i = 0; i < par2 / 16; i++)
            {
                for (int j = 0; j < par3 / 16; j++)
                {
                    float f4 = f + (float)((i + 1) * 16);
                    float f5 = f + (float)(i * 16);
                    float f6 = f1 + (float)((j + 1) * 16);
                    float f7 = f1 + (float)(j * 16);
                    Func_160_a(par1EntityPainting, (f4 + f5) / 2.0F, (f6 + f7) / 2.0F);
                    float       f8          = (float)((par4 + par2) - i * 16) / 256F;
                    float       f9          = (float)((par4 + par2) - (i + 1) * 16) / 256F;
                    float       f10         = (float)((par5 + par3) - j * 16) / 256F;
                    float       f11         = (float)((par5 + par3) - (j + 1) * 16) / 256F;
                    float       f12         = 0.75F;
                    float       f13         = 0.8125F;
                    float       f14         = 0.0F;
                    float       f15         = 0.0625F;
                    float       f16         = 0.75F;
                    float       f17         = 0.8125F;
                    float       f18         = 0.001953125F;
                    float       f19         = 0.001953125F;
                    float       f20         = 0.7519531F;
                    float       f21         = 0.7519531F;
                    float       f22         = 0.0F;
                    float       f23         = 0.0625F;
                    Tessellator tessellator = Tessellator.Instance;
                    tessellator.StartDrawingQuads();
                    tessellator.SetNormal(0.0F, 0.0F, -1F);
                    tessellator.AddVertexWithUV(f4, f7, f2, f9, f10);
                    tessellator.AddVertexWithUV(f5, f7, f2, f8, f10);
                    tessellator.AddVertexWithUV(f5, f6, f2, f8, f11);
                    tessellator.AddVertexWithUV(f4, f6, f2, f9, f11);
                    tessellator.SetNormal(0.0F, 0.0F, 1.0F);
                    tessellator.AddVertexWithUV(f4, f6, f3, f12, f14);
                    tessellator.AddVertexWithUV(f5, f6, f3, f13, f14);
                    tessellator.AddVertexWithUV(f5, f7, f3, f13, f15);
                    tessellator.AddVertexWithUV(f4, f7, f3, f12, f15);
                    tessellator.SetNormal(0.0F, 1.0F, 0.0F);
                    tessellator.AddVertexWithUV(f4, f6, f2, f16, f18);
                    tessellator.AddVertexWithUV(f5, f6, f2, f17, f18);
                    tessellator.AddVertexWithUV(f5, f6, f3, f17, f19);
                    tessellator.AddVertexWithUV(f4, f6, f3, f16, f19);
                    tessellator.SetNormal(0.0F, -1F, 0.0F);
                    tessellator.AddVertexWithUV(f4, f7, f3, f16, f18);
                    tessellator.AddVertexWithUV(f5, f7, f3, f17, f18);
                    tessellator.AddVertexWithUV(f5, f7, f2, f17, f19);
                    tessellator.AddVertexWithUV(f4, f7, f2, f16, f19);
                    tessellator.SetNormal(-1F, 0.0F, 0.0F);
                    tessellator.AddVertexWithUV(f4, f6, f3, f21, f22);
                    tessellator.AddVertexWithUV(f4, f7, f3, f21, f23);
                    tessellator.AddVertexWithUV(f4, f7, f2, f20, f23);
                    tessellator.AddVertexWithUV(f4, f6, f2, f20, f22);
                    tessellator.SetNormal(1.0F, 0.0F, 0.0F);
                    tessellator.AddVertexWithUV(f5, f6, f2, f21, f22);
                    tessellator.AddVertexWithUV(f5, f7, f2, f21, f23);
                    tessellator.AddVertexWithUV(f5, f7, f3, f20, f23);
                    tessellator.AddVertexWithUV(f5, f6, f3, f20, f22);
                    tessellator.Draw();
                }
            }
        }