/// <summary>
        /// Render the block an enderman is carrying
        /// </summary>
        protected virtual void RenderCarrying(EntityEnderman par1EntityEnderman, float par2)
        {
            base.RenderEquippedItems(par1EntityEnderman, par2);

            if (par1EntityEnderman.GetCarried() > 0)
            {
                //GL.Enable(EnableCap.RescaleNormal);
                //GL.PushMatrix();
                float f = 0.5F;
                //GL.Translate(0.0F, 0.6875F, -0.75F);
                f *= 1.0F;
                //GL.Rotate(20F, 1.0F, 0.0F, 0.0F);
                //GL.Rotate(45F, 0.0F, 1.0F, 0.0F);
                //GL.Scale(f, -f, f);
                int i = par1EntityEnderman.GetBrightnessForRender(par2);
                int j = i % 0x10000;
                int k = i / 0x10000;
                OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                LoadTexture("/terrain.png");
                RenderBlocks.RenderBlockAsItem(Block.BlocksList[par1EntityEnderman.GetCarried()], par1EntityEnderman.GetCarryingData(), 1.0F);
                //GL.PopMatrix();
                //GL.Disable(EnableCap.RescaleNormal);
            }
        }
        protected virtual int Func_40283_a(EntityDragon par1EntityDragon, int par2, float par3)
        {
            if (par2 == 1)
            {
                //GL.DepthFunc(DepthFunction.Lequal);
            }

            if (par2 != 0)
            {
                return(-1);
            }
            else
            {
                LoadTexture("/mob/enderdragon/ender_eyes.png");
                float f = 1.0F;
                //GL.Enable(EnableCap.Blend);
                //GL.Disable(EnableCap.AlphaTest);
                //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
                //GL.Disable(EnableCap.Lighting);
                //GL.DepthFunc(DepthFunction.Equal);
                int i = 61680;
                int j = i % 0x10000;
                int k = i / 0x10000;
                OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Enable(EnableCap.Lighting);
                //GL.Color4(1.0F, 1.0F, 1.0F, f);
                return(1);
            }
        }
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f = ((float)Age + par2) / (float)MaxAge;

            f *= f;
            double d  = EntityToPickUp.PosX;
            double d1 = EntityToPickUp.PosY;
            double d2 = EntityToPickUp.PosZ;
            double d3 = EntityPickingUp.LastTickPosX + (EntityPickingUp.PosX - EntityPickingUp.LastTickPosX) * (double)par2;
            double d4 = EntityPickingUp.LastTickPosY + (EntityPickingUp.PosY - EntityPickingUp.LastTickPosY) * (double)par2 + (double)YOffs;
            double d5 = EntityPickingUp.LastTickPosZ + (EntityPickingUp.PosZ - EntityPickingUp.LastTickPosZ) * (double)par2;
            double d6 = d + (d3 - d) * (double)f;
            double d7 = d1 + (d4 - d1) * (double)f;
            double d8 = d2 + (d5 - d2) * (double)f;
            int    i  = MathHelper2.Floor_double(d6);
            int    j  = MathHelper2.Floor_double(d7 + (double)(YOffset / 2.0F));
            int    k  = MathHelper2.Floor_double(d8);
            int    l  = GetBrightnessForRender(par2);
            int    i1 = l % 0x10000;
            int    j1 = l / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)i1 / 1.0F, (float)j1 / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            d6 -= InterpPosX;
            d7 -= InterpPosY;
            d8 -= InterpPosZ;
            RenderManager.Instance.RenderEntityWithPosYaw(EntityToPickUp, (float)d6, (float)d7, (float)d8, EntityToPickUp.RotationYaw, par2);
        }
        private void Func_160_a(EntityPainting par1EntityPainting, float par2, float par3)
        {
            int i = MathHelper2.Floor_double(par1EntityPainting.PosX);
            int j = MathHelper2.Floor_double(par1EntityPainting.PosY + (double)(par3 / 16F));
            int k = MathHelper2.Floor_double(par1EntityPainting.PosZ);

            if (par1EntityPainting.Direction == 0)
            {
                i = MathHelper2.Floor_double(par1EntityPainting.PosX + (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 1)
            {
                k = MathHelper2.Floor_double(par1EntityPainting.PosZ - (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 2)
            {
                i = MathHelper2.Floor_double(par1EntityPainting.PosX - (double)(par2 / 16F));
            }

            if (par1EntityPainting.Direction == 3)
            {
                k = MathHelper2.Floor_double(par1EntityPainting.PosZ + (double)(par2 / 16F));
            }

            int l  = RenderManager.WorldObj.GetLightBrightnessForSkyBlocks(i, j, k, 0);
            int i1 = l % 0x10000;
            int j1 = l / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, i1, j1);
            //GL.Color3(1.0F, 1.0F, 1.0F);
        }
        protected virtual void Func_48419_a(EntityIronGolem par1EntityIronGolem, float par2)
        {
            base.RenderEquippedItems(par1EntityIronGolem, par2);

            if (par1EntityIronGolem.Func_48117_D_() == 0)
            {
                return;
            }
            else
            {
                //GL.Enable(EnableCap.RescaleNormal);
                //GL.PushMatrix();
                //GL.Rotate(5F + (180F * Field_48422_c.Field_48233_c.RotateAngleX) / (float)Math.PI, 1.0F, 0.0F, 0.0F);
                //GL.Translate(-0.6875F, 1.25F, -0.9375F);
                //GL.Rotate(90F, 1.0F, 0.0F, 0.0F);
                float f = 0.8F;
                //GL.Scale(f, -f, f);
                int i = par1EntityIronGolem.GetBrightnessForRender(par2);
                int j = i % 0x10000;
                int k = i / 0x10000;
                OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                LoadTexture("/terrain.png");
                RenderBlocks.RenderBlockAsItem(Block.PlantRed, 0, 1.0F);
                //GL.PopMatrix();
                //GL.Disable(EnableCap.RescaleNormal);
                return;
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Render this TileEntity at its current position from the player
 /// </summary>
 public virtual void RenderTileEntity(TileEntity par1TileEntity, float par2)
 {
     if (par1TileEntity.GetDistanceFrom(PlayerX, PlayerY, PlayerZ) < 4096D)
     {
         int i = WorldObj.GetLightBrightnessForSkyBlocks(par1TileEntity.XCoord, par1TileEntity.YCoord, par1TileEntity.ZCoord, 0);
         int j = i % 0x10000;
         int k = i / 0x10000;
         OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
         //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
         RenderTileEntityAt(par1TileEntity, par1TileEntity.XCoord - StaticPlayerX, par1TileEntity.YCoord - StaticPlayerY, par1TileEntity.ZCoord - StaticPlayerZ, par2);
     }
 }
        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();
        }
Esempio n. 8
0
        /// <summary>
        /// Will render the specified entity at the specified partial tick time. Args: entity, partialTickTime
        /// </summary>
        public virtual void RenderEntity(Entity par1Entity, float par2)
        {
            double d  = par1Entity.LastTickPosX + (par1Entity.PosX - par1Entity.LastTickPosX) * (double)par2;
            double d1 = par1Entity.LastTickPosY + (par1Entity.PosY - par1Entity.LastTickPosY) * (double)par2;
            double d2 = par1Entity.LastTickPosZ + (par1Entity.PosZ - par1Entity.LastTickPosZ) * (double)par2;
            float  f  = par1Entity.PrevRotationYaw + (par1Entity.RotationYaw - par1Entity.PrevRotationYaw) * par2;
            int    i  = par1Entity.GetBrightnessForRender(par2);

            if (par1Entity.IsBurning())
            {
                i = 0xf000f0;
            }

            int j = i % 0x10000;
            int k = i / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            RenderEntityWithPosYaw(par1Entity, d - RenderPosX, d1 - RenderPosY, d2 - RenderPosZ, f, par2);
        }
 /// <summary>
 /// Sets the spider's glowing eyes
 /// </summary>
 protected virtual int SetSpiderEyeBrightness(EntitySpider par1EntitySpider, int par2, float par3)
 {
     if (par2 != 0)
     {
         return(-1);
     }
     else
     {
         LoadTexture("/mob/spider_eyes.png");
         float f = 1.0F;
         //GL.Enable(EnableCap.Blend);
         //GL.Disable(EnableCap.AlphaTest);
         //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
         int i = 61680;
         int j = i % 0x10000;
         int k = i / 0x10000;
         OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
         //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
         //GL.Color4(1.0F, 1.0F, 1.0F, f);
         return(1);
     }
 }
        /// <summary>
        /// Draws the data set up in this tessellator and resets the state to prepare for new drawing.
        /// </summary>
        public virtual int Draw()
        {
            if (!IsDrawing)
            {
                throw new InvalidOperationException("Not tesselating!");
            }

            IsDrawing = false;

            if (VertexCount > 0)
            {
                IntBuffer.Clear();
                IntBuffer.Put(RawBuffer, 0, RawBufferIndex);
                ByteBuffer.Position = 0;
                ByteBuffer.Limit(RawBufferIndex * 4);

                if (UseVBO)
                {
                    VboIndex = (VboIndex + 1) % VboCount;
                    //GL.Arb.BindBuffer(BufferTargetArb.ArrayBuffer, VertexBuffers.Get(VboIndex));
                    //GL.Arb.BufferData(BufferTargetArb.ArrayBuffer, (IntPtr)ByteBuffer.Length, ref ByteBuffer, BufferUsageArb.StreamDraw);
                }

                if (HasTexture)
                {
                    if (UseVBO)
                    {
                        //GL.TexCoordPointer(2, TexCoordPointerType.Float, 32, 12);
                    }
                    else
                    {
                        FloatBuffer.Position = 3;
                        //GL.TexCoordPointer(2, TexCoordPointerType.Float, 32, FloatBuffer.Data);
                    }

                    //GL.EnableClientState(ArrayCap.TextureCoordArray);
                }

                if (HasBrightness)
                {
                    OpenGlHelper.SetClientActiveTexture(OpenGlHelper.LightmapTexUnit);

                    if (UseVBO)
                    {
                        //GL.TexCoordPointer(2, TexCoordPointerType.Short, 32, 28);
                    }
                    else
                    {
                        ShortBuffer.Position = 14;
                        //GL.TexCoordPointer(2, TexCoordPointerType.Short, 32, ref ShortBuffer);
                    }

                    //GL.EnableClientState(ArrayCap.TextureCoordArray);
                    OpenGlHelper.SetClientActiveTexture(OpenGlHelper.DefaultTexUnit);
                }

                if (HasColor)
                {
                    if (UseVBO)
                    {
                        //GL.ColorPointer(4, ColorPointerType.UnsignedByte, 32, 20);
                    }
                    else
                    {
                        ByteBuffer.Position = 20;
                        //GL.ColorPointer(4, ColorPointerType.Byte, 32, ByteBuffer.Data);
                    }

                    //GL.EnableClientState(ArrayCap.ColorArray);
                }

                if (HasNormals)
                {
                    if (UseVBO)
                    {
                        //GL.NormalPointer(NormalPointerType.Byte, 32, 24);
                    }
                    else
                    {
                        ByteBuffer.Position = 24;
                        //GL.NormalPointer(NormalPointerType.Byte, 32, ref ByteBuffer);
                    }

                    //GL.EnableClientState(ArrayCap.NormalArray);
                }

                if (UseVBO)
                {
                    //GL.VertexPointer(3, VertexPointerType.Float, 32, 0);
                }
                else
                {
                    FloatBuffer.Position = 0;
                    //GL.VertexPointer(3, VertexPointerType.Float, 32, FloatBuffer.Data);
                }

                //GL.EnableClientState(ArrayCap.VertexArray);

                if (DrawMode == 7 && ConvertQuadsToTriangles)
                {
                    //GL.DrawArrays(BeginMode.Triangles, 0, VertexCount);
                }
                else
                {
                    //GL.DrawArrays((BeginMode)DrawMode, 0, VertexCount);
                }

                //GL.DisableClientState(ArrayCap.VertexArray);

                if (HasTexture)
                {
                    //GL.DisableClientState(ArrayCap.TextureCoordArray);
                }

                if (HasBrightness)
                {
                    OpenGlHelper.SetClientActiveTexture(OpenGlHelper.LightmapTexUnit);
                    //GL.DisableClientState(ArrayCap.TextureCoordArray);
                    OpenGlHelper.SetClientActiveTexture(OpenGlHelper.DefaultTexUnit);
                }

                if (HasColor)
                {
                    //GL.DisableClientState(ArrayCap.ColorArray);
                }

                if (HasNormals)
                {
                    //GL.DisableClientState(ArrayCap.NormalArray);
                }
            }

            int i = RawBufferIndex * 4;

            Reset();
            return(i);
        }
Esempio n. 11
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();
        }
Esempio n. 12
0
        public virtual void DoRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.PushMatrix();
            //GL.Disable(EnableCap.CullFace);
            MainModel.OnGround = RenderSwingProgress(par1EntityLiving, par9);

            if (RenderPassModel != null)
            {
                RenderPassModel.OnGround = MainModel.OnGround;
            }

            MainModel.IsRiding = par1EntityLiving.IsRiding();

            if (RenderPassModel != null)
            {
                RenderPassModel.IsRiding = MainModel.IsRiding;
            }

            MainModel.IsChild = par1EntityLiving.IsChild();

            if (RenderPassModel != null)
            {
                RenderPassModel.IsChild = MainModel.IsChild;
            }

            try
            {
                float f  = Func_48418_a(par1EntityLiving.PrevRenderYawOffset, par1EntityLiving.RenderYawOffset, par9);
                float f1 = Func_48418_a(par1EntityLiving.PrevRotationYawHead, par1EntityLiving.RotationYawHead, par9);
                float f2 = par1EntityLiving.PrevRotationPitch + (par1EntityLiving.RotationPitch - par1EntityLiving.PrevRotationPitch) * par9;
                RenderLivingAt(par1EntityLiving, par2, par4, par6);
                float f3 = HandleRotationFloat(par1EntityLiving, par9);
                RotateCorpse(par1EntityLiving, f3, f, par9);
                float f4 = 0.0625F;
                //GL.Enable(EnableCap.RescaleNormal);
                //GL.Scale(-1F, -1F, 1.0F);
                PreRenderCallback(par1EntityLiving, par9);
                //GL.Translate(0.0F, -24F * f4 - 0.0078125F, 0.0F);
                float f5 = par1EntityLiving.Field_705_Q + (par1EntityLiving.Field_704_R - par1EntityLiving.Field_705_Q) * par9;
                float f6 = par1EntityLiving.Field_703_S - par1EntityLiving.Field_704_R * (1.0F - par9);

                if (par1EntityLiving.IsChild())
                {
                    f6 *= 3F;
                }

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

                //GL.Enable(EnableCap.AlphaTest);
                MainModel.SetLivingAnimations(par1EntityLiving, f6, f5, par9);
                RenderModel(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

                for (int i = 0; i < 4; i++)
                {
                    int j = ShouldRenderPass(par1EntityLiving, i, par9);

                    if (j <= 0)
                    {
                        continue;
                    }

                    RenderPassModel.SetLivingAnimations(par1EntityLiving, f6, f5, par9);
                    RenderPassModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

                    if (j == 15)
                    {
                        float f8 = (float)par1EntityLiving.TicksExisted + par9;
                        LoadTexture("%blur%/misc/glint.png");
                        //GL.Enable(EnableCap.Blend);
                        float f10 = 0.5F;
                        //GL.Color4(f10, f10, f10, 1.0F);
                        //GL.DepthFunc(DepthFunction.Equal);
                        //GL.DepthMask(false);

                        for (int i1 = 0; i1 < 2; i1++)
                        {
                            //GL.Disable(EnableCap.Lighting);
                            float f13 = 0.76F;
                            //GL.Color4(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
                            //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
                            //GL.MatrixMode(MatrixMode.Texture);
                            //GL.LoadIdentity();
                            float f15 = f8 * (0.001F + (float)i1 * 0.003F) * 20F;
                            float f16 = 0.3333333F;
                            //GL.Scale(f16, f16, f16);
                            //GL.Rotate(30F - (float)i1 * 60F, 0.0F, 0.0F, 1.0F);
                            //GL.Translate(0.0F, f15, 0.0F);
                            //GL.MatrixMode(MatrixMode.Modelview);
                            RenderPassModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
                        }

                        //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                        //GL.MatrixMode(MatrixMode.Texture);
                        //GL.DepthMask(true);
                        //GL.LoadIdentity();
                        //GL.MatrixMode(MatrixMode.Modelview);
                        //GL.Enable(EnableCap.Lighting);
                        //GL.Disable(EnableCap.Blend);
                        //GL.DepthFunc(DepthFunction.Lequal);
                    }

                    //GL.Disable(EnableCap.Blend);
                    //GL.Enable(EnableCap.AlphaTest);
                }

                RenderEquippedItems(par1EntityLiving, par9);
                float f7 = par1EntityLiving.GetBrightness(par9);
                int   k  = GetColorMultiplier(par1EntityLiving, f7, par9);
                OpenGlHelper.SetActiveTexture(OpenGlHelper.LightmapTexUnit);
                //GL.Disable(EnableCap.Texture2D);
                OpenGlHelper.SetActiveTexture(OpenGlHelper.DefaultTexUnit);

                if ((k >> 24 & 0xff) > 0 || par1EntityLiving.HurtTime > 0 || par1EntityLiving.DeathTime > 0)
                {
                    //GL.Disable(EnableCap.Texture2D);
                    //GL.Disable(EnableCap.AlphaTest);
                    //GL.Enable(EnableCap.Blend);
                    //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                    //GL.DepthFunc(DepthFunction.Equal);

                    if (par1EntityLiving.HurtTime > 0 || par1EntityLiving.DeathTime > 0)
                    {
                        //GL.Color4(f7, 0.0F, 0.0F, 0.4F);
                        MainModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

                        for (int l = 0; l < 4; l++)
                        {
                            if (InheritRenderPass(par1EntityLiving, l, par9) >= 0)
                            {
                                //GL.Color4(f7, 0.0F, 0.0F, 0.4F);
                                RenderPassModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
                            }
                        }
                    }

                    if ((k >> 24 & 0xff) > 0)
                    {
                        float f9  = (float)(k >> 16 & 0xff) / 255F;
                        float f11 = (float)(k >> 8 & 0xff) / 255F;
                        float f12 = (float)(k & 0xff) / 255F;
                        float f14 = (float)(k >> 24 & 0xff) / 255F;
                        //GL.Color4(f9, f11, f12, f14);
                        MainModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

                        for (int j1 = 0; j1 < 4; j1++)
                        {
                            if (InheritRenderPass(par1EntityLiving, j1, par9) >= 0)
                            {
                                //GL.Color4(f9, f11, f12, f14);
                                RenderPassModel.Render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
                            }
                        }
                    }

                    //GL.DepthFunc(DepthFunction.Lequal);
                    //GL.Disable(EnableCap.Blend);
                    //GL.Enable(EnableCap.AlphaTest);
                    //GL.Enable(EnableCap.Texture2D);
                }

                //GL.Disable(EnableCap.RescaleNormal);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }

            OpenGlHelper.SetActiveTexture(OpenGlHelper.LightmapTexUnit);
            //GL.Enable(EnableCap.Texture2D);
            OpenGlHelper.SetActiveTexture(OpenGlHelper.DefaultTexUnit);
            //GL.Enable(EnableCap.CullFace);
            //GL.PopMatrix();
            PassSpecialRender(par1EntityLiving, par2, par4, par6);
        }
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            DrawDefaultBackground();
            int i = GuiLeft;
            int j = GuiTop;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        l2 += 10;
                    }

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

            //GL.PopMatrix();
            base.DrawScreen(par1, par2, par3);
            //GL.Enable(EnableCap.Lighting);
            //GL.Enable(EnableCap.DepthTest);
        }