Пример #1
0
        public virtual void Func_40449_a(TileEntityEnchantmentTable par1TileEntityEnchantmentTable, double par2, double par4, double par6, float par8)
        {
            //GL.PushMatrix();
            //GL.Translate((float)par2 + 0.5F, (float)par4 + 0.75F, (float)par6 + 0.5F);
            float f = (float)par1TileEntityEnchantmentTable.TickCount + par8;
            //GL.Translate(0.0F, 0.1F + MathHelper.Sin(f * 0.1F) * 0.01F, 0.0F);
            float f1;

            for (f1 = par1TileEntityEnchantmentTable.BookRotation2 - par1TileEntityEnchantmentTable.BookRotationPrev; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F))
            {
            }

            for (; f1 < -(float)Math.PI; f1 += ((float)Math.PI * 2F))
            {
            }

            float f2 = par1TileEntityEnchantmentTable.BookRotationPrev + f1 * par8;

            //GL.Rotate((-f2 * 180F) / (float)Math.PI, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(80F, 0.0F, 0.0F, 1.0F);
            BindTextureByName("/item/book.png");
            float f3 = par1TileEntityEnchantmentTable.PageFlipPrev + (par1TileEntityEnchantmentTable.PageFlip - par1TileEntityEnchantmentTable.PageFlipPrev) * par8 + 0.25F;
            float f4 = par1TileEntityEnchantmentTable.PageFlipPrev + (par1TileEntityEnchantmentTable.PageFlip - par1TileEntityEnchantmentTable.PageFlipPrev) * par8 + 0.75F;

            f3 = (f3 - (float)MathHelper2.Func_40346_b(f3)) * 1.6F - 0.3F;
            f4 = (f4 - (float)MathHelper2.Func_40346_b(f4)) * 1.6F - 0.3F;

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

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

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

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

            float f5 = par1TileEntityEnchantmentTable.BookSpreadPrev + (par1TileEntityEnchantmentTable.BookSpread - par1TileEntityEnchantmentTable.BookSpreadPrev) * par8;

            Field_40450_a.Render(null, f, f3, f4, f5, 0.0F, 0.0625F);
            //GL.PopMatrix();
        }
Пример #2
0
        /// <summary>
        /// Draw the background layer for the GuiContainer (everything behind the items)
        /// </summary>
        protected override void DrawGuiContainerBackgroundLayer(float par1, int par2, int par3)
        {
            int i = Mc.RenderEngineOld.GetTexture("/gui/enchant.png");

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(i);
            int j = (Width - XSize) / 2;
            int k = (Height - YSize) / 2;

            DrawTexturedModalRect(j, k, 0, 0, XSize, YSize);
            //GL.PushMatrix();
            //GL.MatrixMode(MatrixMode.Projection);
            //GL.PushMatrix();
            //GL.LoadIdentity();
            ScaledResolution scaledresolution = new ScaledResolution(Mc.GameSettings, Mc.DisplayWidth, Mc.DisplayHeight);

            //GL.Viewport(((scaledresolution.GetScaledWidth() - 320) / 2) * scaledresolution.ScaleFactor, ((scaledresolution.GetScaledHeight() - 240) / 2) * scaledresolution.ScaleFactor, 320 * scaledresolution.ScaleFactor, 240 * scaledresolution.ScaleFactor);
            //GL.Translate(-0.34F, 0.23F, 0.0F);
            Matrix.CreatePerspectiveFieldOfView(90F, 1.333333F, 9F, 80F);
            float f = 1.0F;

            //GL.MatrixMode(MatrixMode.Modelview);
            //GL.LoadIdentity();
            RenderHelper.EnableStandardItemLighting();
            //GL.Translate(0.0F, 3.3F, -16F);
            //GL.Scale(f, f, f);
            float f1 = 5F;

            //GL.Scale(f1, f1, f1);
            //GL.Rotate(180F, 0.0F, 0.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(Mc.RenderEngineOld.GetTexture("/item/book.png"));
            //GL.Rotate(20F, 1.0F, 0.0F, 0.0F);
            float f2 = Field_40221_n + (Field_40224_m - Field_40221_n) * par1;
            //GL.Translate((1.0F - f2) * 0.2F, (1.0F - f2) * 0.1F, (1.0F - f2) * 0.25F);
            //GL.Rotate(-(1.0F - f2) * 90F - 90F, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(180F, 1.0F, 0.0F, 0.0F);
            float f3 = Field_40225_j + (Field_40229_i - Field_40225_j) * par1 + 0.25F;
            float f4 = Field_40225_j + (Field_40229_i - Field_40225_j) * par1 + 0.75F;

            f3 = (f3 - (float)MathHelper2.Func_40346_b(f3)) * 1.6F - 0.3F;
            f4 = (f4 - (float)MathHelper2.Func_40346_b(f4)) * 1.6F - 0.3F;

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

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

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

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

            //GL.Enable(EnableCap.RescaleNormal);
            BookModel.Render(null, 0.0F, f3, f4, f2, 0.0F, 0.0625F);
            //GL.Disable(EnableCap.RescaleNormal);
            RenderHelper.DisableStandardItemLighting();
            //GL.MatrixMode(MatrixMode.Projection);
            //GL.Viewport(0, 0, Mc.DisplayWidth, Mc.DisplayHeight);
            //GL.PopMatrix();
            //GL.MatrixMode(MatrixMode.Modelview);
            //GL.PopMatrix();
            RenderHelper.DisableStandardItemLighting();
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(i);
            EnchantmentNameParts.Instance.SetRandSeed(ContainerEnchantment.NameSeed);

            for (int l = 0; l < 3; l++)
            {
                string s = EnchantmentNameParts.Instance.GenerateRandomEnchantName();
                ZLevel = 0.0F;
                Mc.RenderEngineOld.BindTexture(i);
                int i1 = ContainerEnchantment.EnchantLevels[l];
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

                if (i1 == 0)
                {
                    DrawTexturedModalRect(j + 60, k + 14 + 19 * l, 0, 185, 108, 19);
                    continue;
                }

                string          s1           = (new StringBuilder()).Append("").Append(i1).ToString();
                FontRendererOld fontrenderer = Mc.StandardGalacticFontRenderer;
                int             j1           = 0x685e4a;

                if (Mc.ThePlayer.ExperienceLevel < i1 && !Mc.ThePlayer.Capabilities.IsCreativeMode)
                {
                    DrawTexturedModalRect(j + 60, k + 14 + 19 * l, 0, 185, 108, 19);
                    fontrenderer.DrawSplitString(s, j + 62, k + 16 + 19 * l, 104, (j1 & 0xfefefe) >> 1);
                    fontrenderer = Mc.FontRendererOld;
                    j1           = 0x407f10;
                    fontrenderer.DrawStringWithShadow(s1, (j + 62 + 104) - fontrenderer.GetStringWidth(s1), k + 16 + 19 * l + 7, j1);
                    continue;
                }

                int k1 = par2 - (j + 60);
                int l1 = par3 - (k + 14 + 19 * l);

                if (k1 >= 0 && l1 >= 0 && k1 < 108 && l1 < 19)
                {
                    DrawTexturedModalRect(j + 60, k + 14 + 19 * l, 0, 204, 108, 19);
                    j1 = 0xffff80;
                }
                else
                {
                    DrawTexturedModalRect(j + 60, k + 14 + 19 * l, 0, 166, 108, 19);
                }

                fontrenderer.DrawSplitString(s, j + 62, k + 16 + 19 * l, 104, j1);
                fontrenderer = Mc.FontRendererOld;
                j1           = 0x80ff20;
                fontrenderer.DrawStringWithShadow(s1, (j + 62 + 104) - fontrenderer.GetStringWidth(s1), k + 16 + 19 * l + 7, j1);
            }
        }