Advertisement
ZornTaov

RenderTank

Mar 6th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.81 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 RenderTank extends Render
  9. {
  10.  
  11.     public RenderTank()
  12.     {
  13.         shadowSize = 2F;
  14.         modelTank = new ModelTank();
  15.     }
  16.  
  17.     public void func_157_a(EntityTank entitytank, double d, double d1, double d2,
  18.             float f, float f1)
  19.     {
  20.         GL11.glPushMatrix();
  21.     //float f2 = entitytank.riddenByEntity.prevRenderYawOffset + (entitytank.riddenByEntity.renderYawOffset - entitytank.riddenByEntity.prevRenderYawOffset) * f1;
  22.         float f5 = 0;
  23.         float f6 = 0;
  24.     if(entitytank.riddenByEntity != null)
  25.     {
  26.         f5 = entitytank.riddenByEntity.prevRotationYaw + (entitytank.riddenByEntity.rotationYaw - entitytank.riddenByEntity.prevRotationYaw) * f1 - entitytank.prevRotationYaw;
  27.         f6 = entitytank.riddenByEntity.prevRotationPitch + (entitytank.riddenByEntity.rotationPitch - entitytank.riddenByEntity.prevRotationPitch) * f1;
  28.         for(int i = 5; i < 11; i++)
  29.         {
  30.             modelTank.sideModels[i].rotateAngleZ = entitytank.wheelRotation;
  31.             }
  32.     }else
  33.     {
  34.         for(int i = 5; i < 11; i++)
  35.         {
  36.             modelTank.sideModels[i].rotateAngleZ = 0F;
  37.             }
  38.     }
  39.     /*double d3 = entitytank.lastTickPosX + (entitytank.posX - entitytank.lastTickPosX) * (double)f1;
  40.         double d4 = entitytank.lastTickPosY + (entitytank.posY - entitytank.lastTickPosY) * (double)f1;
  41.         double d5 = entitytank.lastTickPosZ + (entitytank.posZ - entitytank.lastTickPosZ) * (double)f1;
  42.         double d6 = 0.30000001192092896D;
  43.         Vec3D vec3d = entitytank.func_514_g(d3, d4, d5);
  44.         float f2 = entitytank.prevRotationPitch + (entitytank.rotationPitch - entitytank.prevRotationPitch) * f1;
  45.         if(vec3d != null)
  46.         {
  47.             Vec3D vec3d1 = entitytank.func_515_a(d3, d4, d5, d6);
  48.             Vec3D vec3d2 = entitytank.func_515_a(d3, d4, d5, -d6);
  49.             if(vec3d1 == null)
  50.             {
  51.                 vec3d1 = vec3d;
  52.             }
  53.             if(vec3d2 == null)
  54.             {
  55.                 vec3d2 = vec3d;
  56.             }
  57.             d += vec3d.xCoord - d3;
  58.             d1 += (vec3d1.yCoord + vec3d2.yCoord) / 2D - d4;
  59.             d2 += vec3d.zCoord - d5;
  60.             Vec3D vec3d3 = vec3d2.addVector(-vec3d1.xCoord, -vec3d1.yCoord, -vec3d1.zCoord);
  61.             if(vec3d3.lengthVector() != 0.0D)
  62.             {
  63.                 vec3d3 = vec3d3.normalize();
  64.                 f = (float)((Math.atan2(vec3d3.zCoord, vec3d3.xCoord) * 180D) / 3.1415926535897931D);
  65.                 f2 = (float)(Math.atan(vec3d3.yCoord) * 73D);
  66.             }
  67.         }*/
  68.         GL11.glTranslatef((float)d, (float)d1, (float)d2);
  69.         GL11.glRotatef(180F - f, 0.0F, 1.0F, 0.0F);
  70.     //GL11.glRotatef(-f2, 0.0F, 0.0F, 1.0F);
  71.         float f2 = (float)entitytank.tankTimeSinceHit - f1;
  72.         float f3 = (float)entitytank.tankCurrentDamage - f1;
  73.         if(f3 < 0.0F)
  74.         {
  75.             f3 = 0.0F;
  76.         }
  77.         if(f2 > 0.0F)
  78.         {
  79.             GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float)entitytank.tankRockDirection, 1.0F, 0.0F, 0.0F);
  80.         }
  81.    
  82.     modelTank.tank = entitytank;
  83.         loadTexture("/terrain.png");
  84.         float f4 = 0.75F;
  85.         GL11.glScalef(f4, f4, f4);
  86.         GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4);
  87.         loadTexture("/item/tanktexture.png");
  88.         GL11.glScalef(-1F, -1F, 1.0F);
  89.         modelTank.render(0.0F, 0.0F, -0.1F, f5, f6, 0.0625F);
  90.         GL11.glPopMatrix();
  91.     }
  92.  
  93.     public void doRender(Entity entity, double d, double d1, double d2,
  94.             float f, float f1)
  95.     {
  96.         func_157_a((EntityTank)entity, d, d1, d2, f, f1);
  97.     }
  98.     protected ModelTank modelTank;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement