/// <summary> /// Draws a rectangle with a vertical gradient between the specified colors. /// </summary> protected virtual void DrawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { float f = (float)(par5 >> 24 & 0xff) / 255F; float f1 = (float)(par5 >> 16 & 0xff) / 255F; float f2 = (float)(par5 >> 8 & 0xff) / 255F; float f3 = (float)(par5 & 0xff) / 255F; float f4 = (float)(par6 >> 24 & 0xff) / 255F; float f5 = (float)(par6 >> 16 & 0xff) / 255F; float f6 = (float)(par6 >> 8 & 0xff) / 255F; float f7 = (float)(par6 & 0xff) / 255F; //GL.Disable(EnableCap.Texture2D); //GL.Enable(EnableCap.Blend); //GL.Disable(EnableCap.AlphaTest); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //GL.ShadeModel(ShadingModel.Smooth); Tessellator tessellator = Tessellator.Instance; tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_F(f1, f2, f3, f); tessellator.AddVertex(par3, par2, ZLevel); tessellator.AddVertex(par1, par2, ZLevel); tessellator.SetColorRGBA_F(f5, f6, f7, f4); tessellator.AddVertex(par1, par4, ZLevel); tessellator.AddVertex(par3, par4, ZLevel); tessellator.Draw(); //GL.ShadeModel(ShadingModel.Flat); //GL.Disable(EnableCap.Blend); //GL.Enable(EnableCap.AlphaTest); //GL.Enable(EnableCap.Texture2D); }
/// <summary> /// Draws a solid color rectangle with the specified coordinates and color. /// </summary> public static void DrawRect(int par1, int par2, int par3, int par4, int par5) { if (par1 < par3) { int i = par1; par1 = par3; par3 = i; } if (par2 < par4) { int j = par2; par2 = par4; par4 = j; } float f = (float)(par5 >> 24 & 0xff) / 255F; float f1 = (float)(par5 >> 16 & 0xff) / 255F; float f2 = (float)(par5 >> 8 & 0xff) / 255F; float f3 = (float)(par5 & 0xff) / 255F; Tessellator tessellator = Tessellator.Instance; //GL.Enable(EnableCap.Blend); //GL.Disable(EnableCap.Texture2D); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //GL.Color4(f1, f2, f3, f); tessellator.StartDrawingQuads(); tessellator.AddVertex(par1, par4, 0.0F); tessellator.AddVertex(par3, par4, 0.0F); tessellator.AddVertex(par3, par2, 0.0F); tessellator.AddVertex(par1, par2, 0.0F); tessellator.Draw(); //GL.Enable(EnableCap.Texture2D); //GL.Disable(EnableCap.Blend); }
/// <summary> /// Renders the animation for when an enderdragon dies /// </summary> protected virtual void RenderDragonDying(EntityDragon par1EntityDragon, float par2) { base.RenderEquippedItems(par1EntityDragon, par2); Tessellator tessellator = Tessellator.Instance; if (par1EntityDragon.Field_40178_aA > 0) { RenderHelper.DisableStandardItemLighting(); float f = ((float)par1EntityDragon.Field_40178_aA + par2) / 200F; float f1 = 0.0F; if (f > 0.8F) { f1 = (f - 0.8F) / 0.2F; } Random random = new Random(432); //GL.Disable(EnableCap.Texture2D); //GL.ShadeModel(ShadingModel.Smooth); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One); //GL.Disable(EnableCap.AlphaTest); //GL.Enable(EnableCap.CullFace); //GL.DepthMask(false); //GL.PushMatrix(); //GL.Translate(0.0F, -1F, -2F); for (int i = 0; (float)i < ((f + f * f) / 2.0F) * 60F; i++) { //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 0.0F, 1.0F); //GL.Rotate(random.NextDouble() * 360F, 1.0F, 0.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F, 0.0F, 1.0F, 0.0F); //GL.Rotate(random.NextDouble() * 360F + f * 90F, 0.0F, 0.0F, 1.0F); tessellator.StartDrawing(6); float f2 = (float)random.NextDouble() * 20F + 5F + f1 * 10F; float f3 = (float)random.NextDouble() * 2.0F + 1.0F + f1 * 2.0F; tessellator.SetColorRGBA_I(0xffffff, (int)(255F * (1.0F - f1))); tessellator.AddVertex(0.0F, 0.0F, 0.0F); tessellator.SetColorRGBA_I(0xff00ff, 0); tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.AddVertex(0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.AddVertex(0.0F, f2, 1.0F * f3); tessellator.AddVertex(-0.86599999999999999D * (double)f3, f2, -0.5F * f3); tessellator.Draw(); } //GL.PopMatrix(); //GL.DepthMask(true); //GL.Disable(EnableCap.CullFace); //GL.Disable(EnableCap.Blend); //GL.ShadeModel(ShadingModel.Flat); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Enable(EnableCap.Texture2D); //GL.Enable(EnableCap.AlphaTest); RenderHelper.EnableStandardItemLighting(); } }
/// <summary> /// Used to render a player's name above their head /// </summary> protected virtual void RenderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6) { if (Minecraft.IsGuiEnabled() && par1EntityPlayer != RenderManager.LivingPlayer) { float f = 1.6F; float f1 = 0.01666667F * f; float f2 = par1EntityPlayer.GetDistanceToEntity(RenderManager.LivingPlayer); float f3 = par1EntityPlayer.IsSneaking() ? 32F : 64F; if (f2 < f3) { string s = par1EntityPlayer.Username; if (!par1EntityPlayer.IsSneaking()) { if (par1EntityPlayer.IsPlayerSleeping()) { RenderLivingLabel(par1EntityPlayer, s, par2, par4 - 1.5D, par6, 64); } else { RenderLivingLabel(par1EntityPlayer, s, par2, par4, par6, 64); } } else { FontRenderer fontrenderer = GetFontRendererFromRenderManager(); //GL.PushMatrix(); //GL.Translate((float)par2 + 0.0F, (float)par4 + 2.3F, (float)par6); //GL.Normal3(0.0F, 1.0F, 0.0F); //GL.Rotate(-RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F); //GL.Rotate(RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F); //GL.Scale(-f1, -f1, f1); //GL.Disable(EnableCap.Lighting); //GL.Translate(0.0F, 0.25F / f1, 0.0F); //GL.DepthMask(false); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); Tessellator tessellator = Tessellator.Instance; //GL.Disable(EnableCap.Texture2D); tessellator.StartDrawingQuads(); int i = fontrenderer.GetStringWidth(s) / 2; tessellator.SetColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.AddVertex(-i - 1, -1D, 0.0F); tessellator.AddVertex(-i - 1, 8D, 0.0F); tessellator.AddVertex(i + 1, 8D, 0.0F); tessellator.AddVertex(i + 1, -1D, 0.0F); tessellator.Draw(); //GL.Enable(EnableCap.Texture2D); //GL.DepthMask(true); fontrenderer.DrawString(s, -fontrenderer.GetStringWidth(s) / 2, 0, 0x20ffffff); //GL.Enable(EnableCap.Lighting); //GL.Disable(EnableCap.Blend); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //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 debug or playername text above a living /// </summary> protected virtual void RenderLivingLabel(EntityLiving par1EntityLiving, string par2Str, double par3, double par5, double par7, int par9) { float f = par1EntityLiving.GetDistanceToEntity(RenderManager.LivingPlayer); if (f > (float)par9) { return; } FontRenderer fontrenderer = GetFontRendererFromRenderManager(); float f1 = 1.6F; float f2 = 0.01666667F * f1; //GL.PushMatrix(); //GL.Translate((float)par3 + 0.0F, (float)par5 + 2.3F, (float)par7); //GL.Normal3(0.0F, 1.0F, 0.0F); //GL.Rotate(-RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F); //GL.Rotate(RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F); //GL.Scale(-f2, -f2, f2); //GL.Disable(EnableCap.Lighting); //GL.DepthMask(false); //GL.Disable(EnableCap.DepthTest); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); Tessellator tessellator = Tessellator.Instance; sbyte byte0 = 0; if (par2Str.Equals("deadmau5")) { byte0 = -10; } //GL.Disable(EnableCap.Texture2D); tessellator.StartDrawingQuads(); int i = fontrenderer.GetStringWidth(par2Str) / 2; tessellator.SetColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.AddVertex(-i - 1, -1 + byte0, 0.0F); tessellator.AddVertex(-i - 1, 8 + byte0, 0.0F); tessellator.AddVertex(i + 1, 8 + byte0, 0.0F); tessellator.AddVertex(i + 1, -1 + byte0, 0.0F); tessellator.Draw(); //GL.Enable(EnableCap.Texture2D); fontrenderer.DrawString(par2Str, -fontrenderer.GetStringWidth(par2Str) / 2, byte0, 0x20ffffff); //GL.Enable(EnableCap.DepthTest); //GL.DepthMask(true); fontrenderer.DrawString(par2Str, -fontrenderer.GetStringWidth(par2Str) / 2, byte0, -1); //GL.Enable(EnableCap.Lighting); //GL.Disable(EnableCap.Blend); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.PopMatrix(); }
/// <summary> /// Adds to the tesselator a box using the aabb for the bounds. Args: aabb /// </summary> public static void RenderAABB(AxisAlignedBB par0AxisAlignedBB) { Tessellator tessellator = Tessellator.Instance; tessellator.StartDrawingQuads(); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.Draw(); }
/// <summary> /// Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z /// </summary> public static void RenderOffsetAABB(AxisAlignedBB par0AxisAlignedBB, double par1, double par3, double par5) { //GL.Disable(EnableCap.Texture2D); Tessellator tessellator = Tessellator.Instance; //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); tessellator.StartDrawingQuads(); tessellator.SetTranslation(par1, par3, par5); tessellator.SetNormal(0.0F, 0.0F, -1F); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.SetNormal(0.0F, 0.0F, 1.0F); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.SetNormal(0.0F, -1F, 0.0F); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.SetNormal(0.0F, 1.0F, 0.0F); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.SetNormal(-1F, 0.0F, 0.0F); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.SetNormal(1.0F, 0.0F, 0.0F); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ); tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ); tessellator.SetTranslation(0.0F, 0.0F, 0.0F); tessellator.Draw(); //GL.Enable(EnableCap.Texture2D); }
public virtual void Func_40446_a(TileEntityEndPortal par1TileEntityEndPortal, double par2, double par4, double par6, float par8) { float f = (float)TileEntityRenderer.PlayerX; float f1 = (float)TileEntityRenderer.PlayerY; float f2 = (float)TileEntityRenderer.PlayerZ; //GL.Disable(EnableCap.Lighting); Random random = new Random(31100); float f3 = 0.75F; for (int i = 0; i < 16; i++) { //GL.PushMatrix(); float f4 = 16 - i; float f5 = 0.0625F; float f6 = 1.0F / (f4 + 1.0F); if (i == 0) { BindTextureByName("/misc/tunnel.png"); f6 = 0.1F; f4 = 65F; f5 = 0.125F; //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); } if (i == 1) { BindTextureByName("/misc/particlefield.png"); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); f5 = 0.5F; } float f7 = (float)(-(par4 + (double)f3)); float f8 = f7 + ActiveRenderInfo.ObjectY; float f9 = f7 + f4 + ActiveRenderInfo.ObjectY; float f10 = f8 / f9; f10 = (float)(par4 + (double)f3) + f10; //GL.Translate(f, f10, f2); //GL.TexGen(TextureCoordName.S, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear); //GL.TexGen(TextureCoordName.T, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear); //GL.TexGen(TextureCoordName.R, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear); //GL.TexGen(TextureCoordName.Q, TextureGenParameter.TextureGenMode, (int)TextureGenMode.EyeLinear);/* //GL.TexGen(TextureCoordName.S, TextureGenParameter.ObjectPlane, Func_40447_a(1.0F, 0.0F, 0.0F, 0.0F)); //GL.TexGen(TextureCoordName.T, TextureGenParameter.ObjectPlane, Func_40447_a(0.0F, 0.0F, 1.0F, 0.0F)); //GL.TexGen(TextureCoordName.R, TextureGenParameter.ObjectPlane, Func_40447_a(0.0F, 0.0F, 0.0F, 1.0F)); //GL.TexGen(TextureCoordName.Q, TextureGenParameter.EyePlane, Func_40447_a(0.0F, 1.0F, 0.0F, 0.0F));*/ //GL.Enable(EnableCap.TextureGenS); //GL.Enable(EnableCap.TextureGenT); //GL.Enable(EnableCap.TextureGenR); //GL.Enable(EnableCap.TextureGenQ); //GL.PopMatrix(); //GL.MatrixMode(MatrixMode.Texture); //GL.PushMatrix(); //GL.LoadIdentity(); //GL.Translate(0.0F, (float)(JavaHelper.CurrentTimeMillis() % 0xaae60L) / 700000F, 0.0F); //GL.Scale(f5, f5, f5); //GL.Translate(0.5F, 0.5F, 0.0F); //GL.Rotate((float)(i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F); //GL.Translate(-0.5F, -0.5F, 0.0F); //GL.Translate(-f, -f2, -f1); f8 = f7 + ActiveRenderInfo.ObjectY; //GL.Translate((ActiveRenderInfo.ObjectX * f4) / f8, (ActiveRenderInfo.ObjectZ * f4) / f8, -f1); Tessellator tessellator = Tessellator.Instance; tessellator.StartDrawingQuads(); f10 = random.NextFloat() * 0.5F + 0.1F; float f11 = random.NextFloat() * 0.5F + 0.4F; float f12 = random.NextFloat() * 0.5F + 0.5F; if (i == 0) { f10 = f11 = f12 = 1.0F; } tessellator.SetColorRGBA_F(f10 * f6, f11 * f6, f12 * f6, 1.0F); tessellator.AddVertex(par2, par4 + (double)f3, par6); tessellator.AddVertex(par2, par4 + (double)f3, par6 + 1.0D); tessellator.AddVertex(par2 + 1.0D, par4 + (double)f3, par6 + 1.0D); tessellator.AddVertex(par2 + 1.0D, par4 + (double)f3, par6); tessellator.Draw(); //GL.PopMatrix(); //GL.MatrixMode(MatrixMode.Modelview); } //GL.Disable(EnableCap.Blend); //GL.Disable(EnableCap.TextureGenS); //GL.Disable(EnableCap.TextureGenT); //GL.Disable(EnableCap.TextureGenR); //GL.Disable(EnableCap.TextureGenQ); //GL.Enable(EnableCap.Lighting); }
/// <summary> /// Actually renders the lightning bolt. This method is called through the doRender method. /// </summary> public virtual void DoRenderLightningBolt(EntityLightningBolt par1EntityLightningBolt, double par2, double par4, double par6, float par8, float par9) { Tessellator tessellator = Tessellator.Instance; //GL.Disable(EnableCap.Texture2D); //GL.Disable(EnableCap.Lighting); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One); double[] ad = new double[8]; double[] ad1 = new double[8]; double d = 0.0F; double d1 = 0.0F; Random random = new Random((int)par1EntityLightningBolt.BoltVertex); for (int j = 7; j >= 0; j--) { ad[j] = d; ad1[j] = d1; d += random.Next(11) - 5; d1 += random.Next(11) - 5; } for (int i = 0; i < 4; i++) { Random random1 = new Random((int)par1EntityLightningBolt.BoltVertex); for (int k = 0; k < 3; k++) { int l = 7; int i1 = 0; if (k > 0) { l = 7 - k; } if (k > 0) { i1 = l - 2; } double d2 = ad[l] - d; double d3 = ad1[l] - d1; for (int j1 = l; j1 >= i1; j1--) { double d4 = d2; double d5 = d3; if (k == 0) { d2 += random1.Next(11) - 5; d3 += random1.Next(11) - 5; } else { d2 += random1.Next(31) - 15; d3 += random1.Next(31) - 15; } tessellator.StartDrawing(5); float f = 0.5F; tessellator.SetColorRGBA_F(0.9F * f, 0.9F * f, 1.0F * f, 0.3F); double d6 = 0.10000000000000001D + (double)i * 0.20000000000000001D; if (k == 0) { d6 *= (double)j1 * 0.10000000000000001D + 1.0D; } double d7 = 0.10000000000000001D + (double)i * 0.20000000000000001D; if (k == 0) { d7 *= (double)(j1 - 1) * 0.10000000000000001D + 1.0D; } for (int k1 = 0; k1 < 5; k1++) { double d8 = (par2 + 0.5D) - d6; double d9 = (par6 + 0.5D) - d6; if (k1 == 1 || k1 == 2) { d8 += d6 * 2D; } if (k1 == 2 || k1 == 3) { d9 += d6 * 2D; } double d10 = (par2 + 0.5D) - d7; double d11 = (par6 + 0.5D) - d7; if (k1 == 1 || k1 == 2) { d10 += d7 * 2D; } if (k1 == 2 || k1 == 3) { d11 += d7 * 2D; } tessellator.AddVertex(d10 + d2, par4 + (double)(j1 * 16), d11 + d3); tessellator.AddVertex(d8 + d4, par4 + (double)((j1 + 1) * 16), d9 + d5); } tessellator.Draw(); } } } //GL.Disable(EnableCap.Blend); //GL.Enable(EnableCap.Lighting); //GL.Enable(EnableCap.Texture2D); }
/// <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); } }