/// <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(); } }
/// <summary> /// Adds a quad to the tesselator at the specified position with the set width and height and color. Args: /// tessellator, x, y, width, height, color /// </summary> private void RenderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) { par1Tessellator.StartDrawingQuads(); par1Tessellator.SetColorOpaque_I(par6); par1Tessellator.AddVertex(par2 + 0, par3 + 0, 0.0F); par1Tessellator.AddVertex(par2 + 0, par3 + par5, 0.0F); par1Tessellator.AddVertex(par2 + par4, par3 + par5, 0.0F); par1Tessellator.AddVertex(par2 + par4, par3 + 0, 0.0F); par1Tessellator.Draw(); }
/// <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); }
/// <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); }
/// <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); } }