Example #1
0
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    TurretFeetI.render(f5);
    TurretFeetII.render(f5);
    TurretFeetIII.render(f5);
    TurretFeetIV.render(f5);
    TurretFeetV.render(f5);
    TurretHead.render(f5);
    TurretThroatI.render(f5);
    TurretThroatII.render(f5);
    TurretThroatIII.render(f5);
    TurretThroatIV.render(f5);
    TurretThroatV.render(f5);
    TurretAntennaI.render(f5);
    TurretAntennaII.render(f5);
    RightBarrel.render(f5);
    LeftBarrel.render(f5);

    GL11.glPushMatrix();
    if (this.isGlowTexture) {
      GL11.glScalef(1.1F, 1.1F, 1.1F);
      GL11.glTranslatef(0.010F, -0.11F, -0.00F);
    }
    HealthBar.render(f5);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    if (this.isGlowTexture) {
      GL11.glScalef(1.1F, 1.1F, 1.1F);
      GL11.glTranslatef(-0.010F, -0.11F, -0.00F);
    }
    AmmoBar.render(f5);
    GL11.glPopMatrix();
  }
Example #2
0
  public void setRotationAngles(
      float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    this.TurretHead.rotateAngleY =
        this.TurretAntennaI.rotateAngleY =
            this.TurretAntennaII.rotateAngleY =
                this.RightBarrel.rotateAngleY =
                    this.LeftBarrel.rotateAngleY = f3 / (180F / (float) Math.PI);
    this.TurretHead.rotateAngleX =
        this.TurretAntennaI.rotateAngleX =
            this.TurretAntennaII.rotateAngleX =
                this.RightBarrel.rotateAngleX =
                    this.LeftBarrel.rotateAngleX = f4 / (180F / (float) Math.PI);

    setStaticBody(f3);

    EntityTurret_T2Revolver turret = (EntityTurret_T2Revolver) entity;

    float healthRot =
        -((float) Math.PI / 2F)
            * ((float) (turret.getMaxHealth() - turret.getSrvHealth())
                / (float) turret.getMaxHealth());
    this.HealthBar.rotateAngleZ = healthRot;
    float ammoRot =
        ((float) Math.PI / 2F)
            * ((float) (turret.getMaxAmmo() - turret.getAmmo()) / (float) turret.getMaxAmmo());

    if (TurretUpgrades.hasUpgrade(TUpgInfAmmo.class, turret.upgrades) && turret.getAmmo() > 0) {
      ammoRot = 0F;
    }
    this.AmmoBar.rotateAngleZ = ammoRot;

    double xR =
        Math.sin(turret.rotationYawHead / (180D / Math.PI))
            * ((double) (turret.getRightBarrelOffset()) / (double) turret.getMaxShootTicks());
    double zR =
        Math.cos(turret.rotationYawHead / (180D / Math.PI))
            * ((double) (turret.getRightBarrelOffset()) / (double) turret.getMaxShootTicks());
    double yR =
        -Math.sin(turret.rotationPitch / (180F / (float) Math.PI))
            * ((double) (turret.getRightBarrelOffset()) / (double) turret.getMaxShootTicks());

    double xL =
        Math.sin(turret.rotationYawHead / (180D / Math.PI))
            * ((double) (turret.getLeftBarrelOffset()) / (double) turret.getMaxShootTicks());
    double zL =
        Math.cos(turret.rotationYawHead / (180D / Math.PI))
            * ((double) (turret.getLeftBarrelOffset()) / (double) turret.getMaxShootTicks());
    double yL =
        -Math.sin(turret.rotationPitch / (180F / (float) Math.PI))
            * ((double) (turret.getLeftBarrelOffset()) / (double) turret.getMaxShootTicks());

    xR *= (Math.cos(turret.rotationPitch / (180F / (float) Math.PI)));
    zR *= (Math.cos(turret.rotationPitch / (180F / (float) Math.PI)));
    xL *= (Math.cos(turret.rotationPitch / (180F / (float) Math.PI)));
    zL *= (Math.cos(turret.rotationPitch / (180F / (float) Math.PI)));

    if (turret.getAmmo() <= 0) {
      xR = 0D;
      yR = 0D;
      zR = 0D;
      xL = 0D;
      yL = 0D;
      zL = 0D;
    }

    RightBarrel.rotationPointX = (float) xR * 3F;
    RightBarrel.rotationPointZ = (float) zR * 3F;
    RightBarrel.rotationPointY = (float) yR * 3F;

    LeftBarrel.rotationPointX = (float) xL * 3F;
    LeftBarrel.rotationPointZ = (float) zL * 3F;
    LeftBarrel.rotationPointY = (float) yL * 3F;
  }