Advertisement
Guest User

RenderFlames

a guest
Jul 2nd, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. package swords.entity;
  2.  
  3. import net.minecraft.client.renderer.RenderHelper;
  4. import net.minecraft.client.renderer.Tessellator;
  5. import net.minecraft.client.renderer.entity.Render;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.projectile.EntityFireball;
  8. import net.minecraft.util.MathHelper;
  9. import net.minecraft.util.ResourceLocation;
  10.  
  11. import org.lwjgl.opengl.GL11;
  12. import org.lwjgl.opengl.GL12;
  13.  
  14. import cpw.mods.fml.relauncher.Side;
  15. import cpw.mods.fml.relauncher.SideOnly;
  16.  
  17. @SideOnly(Side.CLIENT)
  18. public class RenderFlames extends Render
  19. {
  20. private static final ResourceLocation flames = new ResourceLocation("swordsmod:textures/entity/fire_beam.png");
  21. private float field_77002_a;
  22.  
  23. public RenderFlames(float par1)
  24. {
  25. this.field_77002_a = par1;
  26. }
  27.  
  28. public void doRenderFlames(EntityFlames entityflames, double par2, double par4, double par6, float par8, float par9)
  29. {
  30. this.bindEntityTexture(entityflames);
  31. GL11.glPushMatrix();
  32. GL11.glTranslatef((float)par2, (float)par4, (float)par6);
  33. GL11.glRotatef(entityflames.prevRotationYaw + (entityflames.rotationYaw - entityflames.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
  34. GL11.glRotatef(entityflames.prevRotationPitch + (entityflames.rotationPitch - entityflames.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
  35. Tessellator tessellator = Tessellator.instance;
  36. byte b0 = 0;
  37. float f2 = 0.0F;
  38. float f3 = 0.5F;
  39. float f4 = (float)(0 + b0 * 10) / 32.0F;
  40. float f5 = (float)(5 + b0 * 10) / 32.0F;
  41. float f6 = 0.0F;
  42. float f7 = 0.15625F;
  43. float f8 = (float)(5 + b0 * 10) / 32.0F;
  44. float f9 = (float)(10 + b0 * 10) / 32.0F;
  45. float f10 = 0.05625F;
  46. GL11.glEnable(GL12.GL_RESCALE_NORMAL);
  47.  
  48. GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
  49. GL11.glScalef(f10, f10, f10);
  50. GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
  51. GL11.glNormal3f(f10, 0.0F, 0.0F);
  52. tessellator.startDrawingQuads();
  53. tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
  54. tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
  55. tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
  56. tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
  57. tessellator.draw();
  58. GL11.glNormal3f(-f10, 0.0F, 0.0F);
  59. tessellator.startDrawingQuads();
  60. tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
  61. tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
  62. tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
  63. tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
  64. tessellator.draw();
  65.  
  66. for (int i = 0; i < 4; ++i)
  67. {
  68. GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
  69. GL11.glNormal3f(0.0F, 0.0F, f10);
  70. tessellator.startDrawingQuads();
  71. tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
  72. tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
  73. tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
  74. tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
  75. tessellator.draw();
  76. }
  77.  
  78. GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  79. GL11.glPopMatrix();
  80. }
  81.  
  82. protected ResourceLocation getEntityTexture(Entity par1Entity)
  83. {
  84. return flames;
  85. }
  86.  
  87. public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
  88. {
  89. this.doRenderFlames((EntityFlames)par1Entity, par2, par4, par6, par8, par9);
  90. }
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement