Exemplo n.º 1
0
        /// <summary>
        /// Renders the item
        /// </summary>
        public virtual void DoRenderItem(EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
        {
            Random.SetSeed(187);
            ItemStack itemstack = par1EntityItem.ItemStack;
            //GL.PushMatrix();
            float f     = MathHelper2.Sin(((float)par1EntityItem.Age + par9) / 10F + par1EntityItem.Field_804_d) * 0.1F + 0.1F;
            float f1    = (((float)par1EntityItem.Age + par9) / 20F + par1EntityItem.Field_804_d) * (180F / (float)Math.PI);
            sbyte byte0 = 1;

            if (par1EntityItem.ItemStack.StackSize > 1)
            {
                byte0 = 2;
            }

            if (par1EntityItem.ItemStack.StackSize > 5)
            {
                byte0 = 3;
            }

            if (par1EntityItem.ItemStack.StackSize > 20)
            {
                byte0 = 4;
            }

            //GL.Translate((float)par2, (float)par4 + f, (float)par6);
            //GL.Enable(EnableCap.RescaleNormal);

            if (itemstack.ItemID < 256 && RenderBlocks.RenderItemIn3d(Block.BlocksList[itemstack.ItemID].GetRenderType()))
            {
                //GL.Rotate(f1, 0.0F, 1.0F, 0.0F);
                LoadTexture("/terrain.png");
                float f2 = 0.25F;
                int   k  = Block.BlocksList[itemstack.ItemID].GetRenderType();

                if (k == 1 || k == 19 || k == 12 || k == 2)
                {
                    f2 = 0.5F;
                }

                //GL.Scale(f2, f2, f2);

                for (int j1 = 0; j1 < byte0; j1++)
                {
                    //GL.PushMatrix();

                    if (j1 > 0)
                    {
                        float f5  = ((Random.NextFloat() * 2.0F - 1.0F) * 0.2F) / f2;
                        float f8  = ((Random.NextFloat() * 2.0F - 1.0F) * 0.2F) / f2;
                        float f11 = ((Random.NextFloat() * 2.0F - 1.0F) * 0.2F) / f2;
                        //GL.Translate(f5, f8, f11);
                    }

                    float f6 = 1.0F;
                    RenderBlocks.RenderBlockAsItem(Block.BlocksList[itemstack.ItemID], itemstack.GetItemDamage(), f6);
                    //GL.PopMatrix();
                }
            }
            else if (itemstack.GetItem().Func_46058_c())
            {
                //GL.Scale(0.5F, 0.5F, 0.5F);
                LoadTexture("/gui/items.png");

                for (int i = 0; i <= 1; i++)
                {
                    int   l  = itemstack.GetItem().Func_46057_a(itemstack.GetItemDamage(), i);
                    float f3 = 1.0F;

                    if (Field_27004_a)
                    {
                        int   k1  = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), i);
                        float f9  = (float)(k1 >> 16 & 0xff) / 255F;
                        float f12 = (float)(k1 >> 8 & 0xff) / 255F;
                        float f14 = (float)(k1 & 0xff) / 255F;
                        //GL.Color4(f9 * f3, f12 * f3, f14 * f3, 1.0F);
                    }

                    Func_40267_a(l, byte0);
                }
            }
            else
            {
                //GL.Scale(0.5F, 0.5F, 0.5F);
                int j = itemstack.GetIconIndex();

                if (itemstack.ItemID < 256)
                {
                    LoadTexture("/terrain.png");
                }
                else
                {
                    LoadTexture("/gui/items.png");
                }

                if (Field_27004_a)
                {
                    int   i1  = Item.ItemsList[itemstack.ItemID].GetColorFromDamage(itemstack.GetItemDamage(), 0);
                    float f4  = (float)(i1 >> 16 & 0xff) / 255F;
                    float f7  = (float)(i1 >> 8 & 0xff) / 255F;
                    float f10 = (float)(i1 & 0xff) / 255F;
                    float f13 = 1.0F;
                    //GL.Color4(f4 * f13, f7 * f13, f10 * f13, 1.0F);
                }

                Func_40267_a(j, byte0);
            }

            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
Exemplo n.º 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);
            }
        }