/// <summary>
        /// Renders all current particles. Args player, partialTickTime
        /// </summary>
        public virtual void RenderParticles(Entity par1Entity, float par2)
        {
            float f  = ActiveRenderInfo.RotationX;
            float f1 = ActiveRenderInfo.RotationZ;
            float f2 = ActiveRenderInfo.RotationYZ;
            float f3 = ActiveRenderInfo.RotationXY;
            float f4 = ActiveRenderInfo.RotationXZ;

            EntityFX.InterpPosX = par1Entity.LastTickPosX + (par1Entity.PosX - par1Entity.LastTickPosX) * (double)par2;
            EntityFX.InterpPosY = par1Entity.LastTickPosY + (par1Entity.PosY - par1Entity.LastTickPosY) * (double)par2;
            EntityFX.InterpPosZ = par1Entity.LastTickPosZ + (par1Entity.PosZ - par1Entity.LastTickPosZ) * (double)par2;

            for (int i = 0; i < 3; i++)
            {
                if (FxLayers[i].Count == 0)
                {
                    continue;
                }

                int j = 0;

                if (i == 0)
                {
                    j = Renderer.GetTexture("/particles.png");
                }

                if (i == 1)
                {
                    j = Renderer.GetTexture("/terrain.png");
                }

                if (i == 2)
                {
                    j = Renderer.GetTexture("/gui/items.png");
                }

                //GL.BindTexture(TextureTarget.Texture2D, j);
                Tessellator tessellator = Tessellator.Instance;
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                tessellator.StartDrawingQuads();

                for (int k = 0; k < FxLayers[i].Count; k++)
                {
                    EntityFX entityfx = FxLayers[i][k];
                    tessellator.SetBrightness(entityfx.GetBrightnessForRender(par2));
                    entityfx.RenderParticle(tessellator, par2, f, f4, f1, f2, f3);
                }

                tessellator.Draw();
            }
        }
Example #2
0
        /// <summary>
        /// Renders the item's icon or block into the UI at the specified position.
        /// </summary>
        public virtual void RenderItemIntoGUI(FontRenderer par1FontRenderer, RenderEngineOld par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
        {
            if (par3ItemStack == null)
            {
                return;
            }

            DrawItemIntoGui(par1FontRenderer, par2RenderEngine, par3ItemStack.ItemID, par3ItemStack.GetItemDamage(), par3ItemStack.GetIconIndex(), par4, par5);

            if (par3ItemStack != null && par3ItemStack.HasEffect())
            {
                //GL.DepthFunc(DepthFunction.Greater);
                //GL.Disable(EnableCap.Lighting);
                //GL.DepthMask(false);
                par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("%blur%/misc/glint.png"));
                ZLevel -= 50F;
                //GL.Enable(EnableCap.Blend);
                //GL.BlendFunc(BlendingFactorSrc.DstColor, BlendingFactorDest.DstColor);
                //GL.Color4(0.5F, 0.25F, 0.8F, 1.0F);
                Func_40266_a(par4 * 0x19b4ca14 + par5 * 0x1eafff1, par4 - 2, par5 - 2, 20, 20);
                //GL.Disable(EnableCap.Blend);
                //GL.DepthMask(true);
                ZLevel += 50F;
                //GL.Enable(EnableCap.Lighting);
                //GL.DepthFunc(DepthFunction.Lequal);
            }
        }
Example #3
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();
        }
Example #4
0
        public virtual void DrawItemIntoGui(FontRenderer par1FontRenderer, RenderEngineOld par2RenderEngine, int par3, int par4, int par5, int par6, int par7)
        {
            if (par3 < 256 && RenderBlocks.RenderItemIn3d(Block.BlocksList[par3].GetRenderType()))
            {
                int i = par3;
                par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("/terrain.png"));
                Block block = Block.BlocksList[i];
                //GL.PushMatrix();
                //GL.Translate(par6 - 2, par7 + 3, -3F + ZLevel);
                //GL.Scale(10F, 10F, 10F);
                //GL.Translate(1.0F, 0.5F, 1.0F);
                //GL.Scale(1.0F, 1.0F, -1F);
                //GL.Rotate(210F, 1.0F, 0.0F, 0.0F);
                //GL.Rotate(45F, 0.0F, 1.0F, 0.0F);
                int   i1 = Item.ItemsList[par3].GetColorFromDamage(par4, 0);
                float f2 = (float)(i1 >> 16 & 0xff) / 255F;
                float f5 = (float)(i1 >> 8 & 0xff) / 255F;
                float f7 = (float)(i1 & 0xff) / 255F;

                if (Field_27004_a)
                {
                    //GL.Color4(f2, f5, f7, 1.0F);
                }

                //GL.Rotate(-90F, 0.0F, 1.0F, 0.0F);
                RenderBlocks.UseInventoryTint = Field_27004_a;
                RenderBlocks.RenderBlockAsItem(block, par4, 1.0F);
                RenderBlocks.UseInventoryTint = true;
                //GL.PopMatrix();
            }
            else if (Item.ItemsList[par3].Func_46058_c())
            {
                //GL.Disable(EnableCap.Lighting);
                par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("/gui/items.png"));

                for (int j = 0; j <= 1; j++)
                {
                    int   l  = Item.ItemsList[par3].Func_46057_a(par4, j);
                    int   j1 = Item.ItemsList[par3].GetColorFromDamage(par4, j);
                    float f3 = (float)(j1 >> 16 & 0xff) / 255F;
                    float f6 = (float)(j1 >> 8 & 0xff) / 255F;
                    float f8 = (float)(j1 & 0xff) / 255F;

                    if (Field_27004_a)
                    {
                        //GL.Color4(f3, f6, f8, 1.0F);
                    }

                    RenderTexturedQuad(par6, par7, (l % 16) * 16, (l / 16) * 16, 16, 16);
                }

                //GL.Enable(EnableCap.Lighting);
            }
            else if (par5 >= 0)
            {
                //GL.Disable(EnableCap.Lighting);

                if (par3 < 256)
                {
                    par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("/terrain.png"));
                }
                else
                {
                    par2RenderEngine.BindTexture(par2RenderEngine.GetTexture("/gui/items.png"));
                }

                int   k  = Item.ItemsList[par3].GetColorFromDamage(par4, 0);
                float f  = (float)(k >> 16 & 0xff) / 255F;
                float f1 = (float)(k >> 8 & 0xff) / 255F;
                float f4 = (float)(k & 0xff) / 255F;

                if (Field_27004_a)
                {
                    //GL.Color4(f, f1, f4, 1.0F);
                }

                RenderTexturedQuad(par6, par7, (par5 % 16) * 16, (par5 / 16) * 16, 16, 16);
                //GL.Enable(EnableCap.Lighting);
            }

            //GL.Enable(EnableCap.CullFace);
        }