Advertisement
ZornTaov

RenderTankBullet

Mar 17th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.63 KB | None | 0 0
  1. package net.minecraft.src;
  2. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  3. // Jad home page: http://www.kpdus.com/jad.html
  4. // Decompiler options: packimports(3) braces deadcode
  5.  
  6. import org.lwjgl.opengl.GL11;
  7.  
  8. public class RenderTankBullet extends Render
  9. {
  10.  
  11.     public RenderTankBullet()
  12.     {
  13.     }
  14.    
  15.     private void bulletTypeSetup(float u1, float u2, float v1, float v2, float u3, float u4, float v3, float v4, float diameter)
  16.     {
  17.     UVs[0] = u1 / 32F;
  18.     UVs[1] = u2 / 32F;
  19.     UVs[2] = v1 / 32F;
  20.     UVs[3] = v2 / 32F;
  21.     UVs[4] = u3 / 32F;
  22.     UVs[5] = u4 / 32F;
  23.     UVs[6] = v3 / 32F;
  24.     UVs[7] = v4 / 32F;
  25.     UVs[8] = diameter;
  26.     }
  27.    
  28.     public void func_154_a(EntityTankBullet entitytankbullet, double d, double d1, double d2,
  29.             float f, float f1)
  30.     {
  31.     if(entitytankbullet.type >=0 && entitytankbullet.type <=4)
  32.     {
  33.         loadTexture("/item/entityTankBullet.png");
  34.     }
  35.         GL11.glPushMatrix();
  36.         GL11.glTranslatef((float)d, (float)d1, (float)d2);
  37.         GL11.glRotatef((entitytankbullet.prevRotationYaw + (entitytankbullet.rotationYaw - entitytankbullet.prevRotationYaw) * f1) - 90F, 0.0F, 1.0F, 0.0F);
  38.         GL11.glRotatef(entitytankbullet.prevRotationPitch + (entitytankbullet.rotationPitch - entitytankbullet.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F);
  39.         Tessellator tessellator = Tessellator.instance;
  40.     if(entitytankbullet.type == 0)
  41.     {
  42.         bulletTypeSetup(0, 16, 0, 10, 0, 10, 10, 20, 4);
  43.     }
  44.     if(entitytankbullet.type == 1)
  45.     {
  46.         bulletTypeSetup(0, 16, 20, 25, 0, 5, 25, 30, 2);
  47.     }
  48.     float f10 = 0.05625F;
  49.         GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
  50.         float f11 = (float)entitytankbullet.TankBulletShake - f1;
  51.         if(f11 > 0.0F)
  52.         {
  53.             float f12 = -MathHelper.sin(f11 * 3F) * f11;
  54.             GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
  55.         }
  56.         GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F);
  57.         GL11.glScalef(f10, f10, f10);
  58.         GL11.glTranslatef(-4F, 0.0F, 0.0F);
  59.         GL11.glNormal3f(f10, 0.0F, 0.0F);
  60.         tessellator.startDrawingQuads();
  61.         tessellator.addVertexWithUV(-8D, -UVs[8], -UVs[8], UVs[4], UVs[6]);
  62.         tessellator.addVertexWithUV(-8D, -UVs[8], UVs[8], UVs[5], UVs[6]);
  63.         tessellator.addVertexWithUV(-8D, UVs[8], UVs[8], UVs[5], UVs[7]);
  64.         tessellator.addVertexWithUV(-8D, UVs[8], -UVs[8], UVs[4], UVs[7]);
  65.         tessellator.draw();
  66.         GL11.glNormal3f(-f10, 0.0F, 0.0F);
  67.         tessellator.startDrawingQuads();
  68.         tessellator.addVertexWithUV(-8D, UVs[8], -UVs[8], UVs[4], UVs[6]);
  69.         tessellator.addVertexWithUV(-8D, UVs[8], UVs[8], UVs[5], UVs[6]);
  70.         tessellator.addVertexWithUV(-8D, -UVs[8], UVs[8], UVs[5], UVs[7]);
  71.         tessellator.addVertexWithUV(-8D, -UVs[8], -UVs[8], UVs[4], UVs[7]);
  72.         tessellator.draw();
  73.         for(int j = 0; j < 4; j++)
  74.         {
  75.             GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
  76.             GL11.glNormal3f(0.0F, 0.0F, f10);
  77.             tessellator.startDrawingQuads();
  78.             tessellator.addVertexWithUV(-8D, -UVs[8], 0.0D, UVs[0], UVs[2]);
  79.             tessellator.addVertexWithUV(8D, -UVs[8], 0.0D, UVs[1], UVs[2]);
  80.             tessellator.addVertexWithUV(8D, UVs[8], 0.0D, UVs[1], UVs[3]);
  81.             tessellator.addVertexWithUV(-8D, UVs[8], 0.0D, UVs[0], UVs[3]);
  82.             tessellator.draw();
  83.         }
  84.  
  85.         GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
  86.         GL11.glPopMatrix();
  87.     }
  88.  
  89.     public void doRender(Entity entity, double d, double d1, double d2,
  90.             float f, float f1)
  91.     {
  92.         func_154_a((EntityTankBullet)entity, d, d1, d2, f, f1);
  93.     }
  94.     private float UVs[] = new float[9];
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement