Advertisement
ZornTaov

RenderTank

Mar 13th, 2011
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.92 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 f5 = 0;
  22.         float f6 = 0;
  23.     if(entitytank.riddenByEntity != null)
  24.     {
  25.         f5 = entitytank.riddenByEntity.prevRotationYaw + (entitytank.riddenByEntity.rotationYaw - entitytank.riddenByEntity.prevRotationYaw) * f1 - entitytank.prevRotationYaw - 90;
  26.         f6 = entitytank.riddenByEntity.prevRotationPitch + (entitytank.riddenByEntity.rotationPitch - entitytank.riddenByEntity.prevRotationPitch) * f1;
  27.         for(int i = 5; i < 11; i++)
  28.         {
  29.             modelTank.sideModels[i].rotateAngleZ = entitytank.wheelRotation;
  30.             }
  31.         for(int i = 30; i < 37; i++)
  32.         {
  33.         modelTank.sideModels[i].rotateAngleY = f5 / 57.29578F;
  34.         }
  35.         modelTank.turret.relativeAngles.angleY = f5 / 57.29578F;
  36.         modelTank.muzzle.relativeAngles.angleX = -f6 / 57.29578F;
  37.    
  38.     }else
  39.     {
  40.         for(int i = 5; i < 11; i++)
  41.         {
  42.             modelTank.sideModels[i].rotateAngleZ = 0F;
  43.             }
  44.         for(int i = 30; i < 37; i++)
  45.         {
  46.         modelTank.sideModels[i].rotateAngleY = 0F;
  47.         }
  48.         modelTank.turret.relativeAngles.angleY = 0F;
  49.         modelTank.muzzle.relativeAngles.angleX = 0F;
  50.     }
  51.         float f8 = entitytank.prevRotationPitch + (entitytank.rotationPitch - entitytank.prevRotationPitch) * f1;
  52.         float f9 = entitytank.prevRotationYaw + (entitytank.rotationYaw - entitytank.prevRotationYaw) * f1;
  53.         //d = entitytank.prevPosX + (entitytank.posX - entitytank.prevPosX) * (double)f1;
  54.         //d1 = (entitytank.prevPosY + (entitytank.posY - entitytank.prevPosY) * (double)f1 + 1.6200000000000001D) - (double)entitytank.yOffset;
  55.         //d2 = entitytank.prevPosZ + (entitytank.posZ - entitytank.prevPosZ) * (double)f1;
  56.         Vec3D vec3d = Vec3D.createVector(d, d1, d2);
  57.         float f10 = MathHelper.cos(-f9 * 0.01745329F - 3.141593F);
  58.         float f11 = MathHelper.sin(-f9 * 0.01745329F - 3.141593F);
  59.         float f12 = -MathHelper.cos(-f8 * 0.01745329F);
  60.         float f13 = MathHelper.sin(-f8 * 0.01745329F);
  61.         float f14 = f11 * f12;
  62.         float f15 = f13;
  63.         float f16 = f10 * f12;
  64.         double d3 = 5D;
  65.         Vec3D vec3d1 = vec3d.addVector((double)f14 * d3, (double)f15 * d3, (double)f16 * d3);
  66.         MovingObjectPosition movingobjectposition = entitytank.worldObj.rayTraceBlocks_do(vec3d, vec3d1, true);
  67.         if(movingobjectposition != null)
  68.         {
  69.        if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
  70.        {
  71.            int i = movingobjectposition.blockX;
  72.            int j = movingobjectposition.blockY;
  73.            int k = movingobjectposition.blockZ;
  74.            System.out.println((new StringBuilder("found at  ")).append(i).append(" ").append(j).append(" ").append(k).toString());
  75.  
  76.        
  77.            if(movingobjectposition.sideHit >= 2 && movingobjectposition.sideHit <= 5)
  78.            {
  79.            j++;
  80.            }
  81.            if(entitytank.worldObj.isAirBlock(i, j, k) || !entitytank.worldObj.getBlockMaterial(i, j, k).isSolid())
  82.            {
  83.        
  84.        
  85.        
  86.     /*double d3 = entitytank.lastTickPosX + (entitytank.posX - entitytank.lastTickPosX) * (double)f1;
  87.         double d4 = entitytank.lastTickPosY + (entitytank.posY - entitytank.lastTickPosY) * (double)f1;
  88.         double d5 = entitytank.lastTickPosZ + (entitytank.posZ - entitytank.lastTickPosZ) * (double)f1;
  89.         double d6 = 0.30000001192092896D;
  90.         Vec3D vec3d = entitytank.func_514_g(d3, d4, d5);
  91.         float f2 = entitytank.prevRotationPitch + (entitytank.rotationPitch - entitytank.prevRotationPitch) * f1;
  92.         if(vec3d != null)
  93.         {
  94.             Vec3D vec3d1 = entitytank.func_515_a(d3, d4, d5, d6);
  95.             Vec3D vec3d2 = entitytank.func_515_a(d3, d4, d5, -d6);
  96.             if(vec3d1 == null)
  97.             {
  98.                 vec3d1 = vec3d;
  99.             }
  100.             if(vec3d2 == null)
  101.             {
  102.                 vec3d2 = vec3d;
  103.             }
  104.             d += vec3d.xCoord - d3;
  105.             d1 += (vec3d1.yCoord + vec3d2.yCoord) / 2D - d4;
  106.             d2 += vec3d.zCoord - d5;*/
  107.             Vec3D vec3d3 = vec3d.addVector(-vec3d1.xCoord, -vec3d1.yCoord, -vec3d1.zCoord);
  108.             if(vec3d3.lengthVector() != 0.0D)
  109.             {
  110.                 vec3d3 = vec3d3.normalize();
  111.                 f = (float)((Math.atan2(vec3d3.zCoord, vec3d3.xCoord) * 180D) / 3.1415926535897931D);
  112.                 f8 = (float)(Math.atan(vec3d3.yCoord) * 73D);
  113.             }
  114.     }/**/}}
  115.         GL11.glTranslatef((float)d, (float)d1, (float)d2);
  116.         GL11.glRotatef(180F - f, 0.0F, 1.0F, 0.0F);
  117.     GL11.glRotatef(-f8, 0.0F, 0.0F, 1.0F);
  118.         float f2 = (float)entitytank.tankTimeSinceHit - f1;
  119.         float f3 = (float)entitytank.tankCurrentDamage - f1;
  120.         if(f3 < 0.0F)
  121.         {
  122.             f3 = 0.0F;
  123.         }
  124.         if(f2 > 0.0F)
  125.         {
  126.             GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float)entitytank.tankRockDirection, 1.0F, 0.0F, 0.0F);
  127.         }
  128.    
  129.     modelTank.tankCS = entitytank;
  130.         loadTexture("/terrain.png");
  131.         float f4 = 0.75F;
  132.         GL11.glScalef(f4, f4, f4);
  133.         GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4);
  134.         loadTexture("/item/tanktexture.png");
  135.         GL11.glScalef(-1F, -1F, 1.0F);
  136.         modelTank.render(0.0F, 0.0F, -0.1F, f5, f6, 0.0625F);
  137.     entitytank.currentModel = modelTank;
  138.         GL11.glPopMatrix();
  139.     }
  140.  
  141.     public void doRender(Entity entity, double d, double d1, double d2,
  142.             float f, float f1)
  143.     {
  144.         func_157_a((EntityTank)entity, d, d1, d2, f, f1);
  145.     }
  146.     public ModelTank modelTank;
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement