Пример #1
0
  public void doRenderLiving(
      EntityLiving par1EntityLiving,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);
    mainModel.onGround = renderSwingProgress(par1EntityLiving, par9);

    if (renderPassModel != null) {
      renderPassModel.onGround = mainModel.onGround;
    }

    mainModel.isRiding = par1EntityLiving.isRiding();

    if (renderPassModel != null) {
      renderPassModel.isRiding = mainModel.isRiding;
    }

    mainModel.isChild = par1EntityLiving.isChild();

    if (renderPassModel != null) {
      renderPassModel.isChild = mainModel.isChild;
    }

    try {
      float f =
          func_48418_a(
              par1EntityLiving.prevRenderYawOffset, par1EntityLiving.renderYawOffset, par9);
      float f1 =
          func_48418_a(
              par1EntityLiving.prevRotationYawHead, par1EntityLiving.rotationYawHead, par9);
      float f2 =
          par1EntityLiving.prevRotationPitch
              + (par1EntityLiving.rotationPitch - par1EntityLiving.prevRotationPitch) * par9;
      renderLivingAt(par1EntityLiving, par2, par4, par6);
      float f3 = handleRotationFloat(par1EntityLiving, par9);
      rotateCorpse(par1EntityLiving, f3, f, par9);
      float f4 = 0.0625F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glScalef(-1F, -1F, 1.0F);
      preRenderCallback(par1EntityLiving, par9);
      if (!bobbing) {
        GL11.glTranslatef(0.0F, -24F * f4 - 0.0078125F, 0.0F);
      }
      float f5 =
          par1EntityLiving.field_705_Q
              + (par1EntityLiving.field_704_R - par1EntityLiving.field_705_Q) * par9;
      float f6;
      if (bobbing) {
        f6 =
            par1EntityLiving.field_9359_x
                + (par1EntityLiving.field_9360_w - par1EntityLiving.field_9359_x) * par9;
        if (par1EntityLiving.isChild()) {
          f6 *= 3F;
        }
        float bobStrength = 0F;
        if ((par1EntityLiving instanceof EntityZombie
                || par1EntityLiving instanceof EntitySkeleton
                || par1EntityLiving instanceof EntityCreeper
                || par1EntityLiving instanceof EntityPig
                || par1EntityLiving instanceof EntitySheep
                || par1EntityLiving instanceof EntityPlayer
                || par1EntityLiving instanceof EntityOtherPlayerMP)
            && !par1EntityLiving.isChild()) {
          bobStrength = 1.0F;
        }
        float f32 =
            par1EntityLiving.field_9362_u
                + (par1EntityLiving.field_9361_v - par1EntityLiving.field_9362_u) * par9;
        float bob = -Math.abs(MathHelper.cos(f6 * 0.6662F)) * 5F * f32 * bobStrength - 23F;
        GL11.glTranslatef(0.0F, bob * f4 - 0.0078125F, 0.0F);
      } else {
        f6 = par1EntityLiving.field_703_S - par1EntityLiving.field_704_R * (1.0F - par9);
        if (par1EntityLiving.isChild()) {
          f6 *= 3F;
        }
      }

      if (f5 > 1.0F) {
        f5 = 1.0F;
      }

      GL11.glEnable(GL11.GL_ALPHA_TEST);
      mainModel.setLivingAnimations(par1EntityLiving, f6, f5, par9);
      renderModel(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

      for (int i = 0; i < 4; i++) {
        int j = shouldRenderPass(par1EntityLiving, i, par9);

        if (j <= 0) {
          continue;
        }

        renderPassModel.setLivingAnimations(par1EntityLiving, f6, f5, par9);
        renderPassModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

        if (j == 15) {
          float f8 = (float) par1EntityLiving.ticksExisted + par9;
          loadTexture("%blur%/misc/glint.png");
          GL11.glEnable(GL11.GL_BLEND);
          float f10 = 0.5F;
          GL11.glColor4f(f10, f10, f10, 1.0F);
          GL11.glDepthFunc(GL11.GL_EQUAL);
          GL11.glDepthMask(false);

          for (int i1 = 0; i1 < 2; i1++) {
            GL11.glDisable(GL11.GL_LIGHTING);
            float f13 = 0.76F;
            GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            float f15 = f8 * (0.001F + (float) i1 * 0.003F) * 20F;
            float f16 = 0.3333333F;
            GL11.glScalef(f16, f16, f16);
            GL11.glRotatef(30F - (float) i1 * 60F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.0F, f15, 0.0F);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            renderPassModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
          }

          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
          GL11.glMatrixMode(GL11.GL_TEXTURE);
          GL11.glDepthMask(true);
          GL11.glLoadIdentity();
          GL11.glMatrixMode(GL11.GL_MODELVIEW);
          GL11.glEnable(GL11.GL_LIGHTING);
          GL11.glDisable(GL11.GL_BLEND);
          GL11.glDepthFunc(GL11.GL_LEQUAL);
        }

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
      }

      renderEquippedItems(par1EntityLiving, par9);
      float f7 = par1EntityLiving.getBrightness(par9);
      int k = getColorMultiplier(par1EntityLiving, f7, par9);
      OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

      if ((k >> 24 & 0xff) > 0 || par1EntityLiving.hurtTime > 0 || par1EntityLiving.deathTime > 0) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDepthFunc(GL11.GL_EQUAL);

        if (par1EntityLiving.hurtTime > 0 || par1EntityLiving.deathTime > 0) {
          GL11.glColor4f(f7, 0.0F, 0.0F, 0.4F);
          mainModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

          for (int l = 0; l < 4; l++) {
            if (inheritRenderPass(par1EntityLiving, l, par9) >= 0) {
              GL11.glColor4f(f7, 0.0F, 0.0F, 0.4F);
              renderPassModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
            }
          }
        }

        if ((k >> 24 & 0xff) > 0) {
          float f9 = (float) (k >> 16 & 0xff) / 255F;
          float f11 = (float) (k >> 8 & 0xff) / 255F;
          float f12 = (float) (k & 0xff) / 255F;
          float f14 = (float) (k >> 24 & 0xff) / 255F;
          GL11.glColor4f(f9, f11, f12, f14);
          mainModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);

          for (int j1 = 0; j1 < 4; j1++) {
            if (inheritRenderPass(par1EntityLiving, j1, par9) >= 0) {
              GL11.glColor4f(f9, f11, f12, f14);
              renderPassModel.render(par1EntityLiving, f6, f5, f3, f1 - f, f2, f4);
            }
          }
        }

        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    } catch (Exception exception) {
      exception.printStackTrace();
    }

    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
    passSpecialRender(par1EntityLiving, par2, par4, par6);
  }
Пример #2
0
  public void doRenderLiving(
      EntityLiving var1, double var2, double var4, double var6, float var8, float var9) {
    GL11.glPushMatrix();
    GL11.glDisable(2884 /*GL_CULL_FACE*/);
    this.mainModel.onGround = this.renderSwingProgress(var1, var9);
    if (this.renderPassModel != null) {
      this.renderPassModel.onGround = this.mainModel.onGround;
    }

    this.mainModel.isRiding = var1.isRiding();
    if (this.renderPassModel != null) {
      this.renderPassModel.isRiding = this.mainModel.isRiding;
    }

    this.mainModel.field_40301_k = var1.func_40127_l();
    if (this.renderPassModel != null) {
      this.renderPassModel.field_40301_k = this.mainModel.field_40301_k;
    }

    try {
      float var10 =
          var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var9;
      float var11 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var9;
      float var12 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9;
      this.renderLivingAt(var1, var2, var4, var6);
      float var13 = this.handleRotationFloat(var1, var9);
      this.rotateCorpse(var1, var13, var10, var9);
      float var14 = 0.0625F;
      GL11.glEnable('\u803a');
      GL11.glScalef(-1.0F, -1.0F, 1.0F);
      this.preRenderCallback(var1, var9);
      GL11.glTranslatef(0.0F, -24.0F * var14 - 0.0078125F, 0.0F);
      float var15 = var1.field_705_Q + (var1.field_704_R - var1.field_705_Q) * var9;
      float var16 = var1.field_703_S - var1.field_704_R * (1.0F - var9);
      if (var1.func_40127_l()) {
        var16 *= 3.0F;
      }

      if (var15 > 1.0F) {
        var15 = 1.0F;
      }

      GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
      this.mainModel.setLivingAnimations(var1, var16, var15, var9);
      this.func_40270_a(var1, var16, var15, var13, var11 - var10, var12, var14);

      float var19;
      int var18;
      float var20;
      float var22;
      for (int var17 = 0; var17 < 4; ++var17) {
        var18 = this.shouldRenderPass(var1, var17, var9);
        if (var18 > 0) {
          this.renderPassModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);
          if (var18 == 15) {
            var19 = (float) var1.ticksExisted + var9;
            this.loadTexture("%blur%/misc/glint.png");
            GL11.glEnable(3042 /*GL_BLEND*/);
            var20 = 0.5F;
            GL11.glColor4f(var20, var20, var20, 1.0F);
            GL11.glDepthFunc(514);
            GL11.glDepthMask(false);

            for (int var21 = 0; var21 < 2; ++var21) {
              GL11.glDisable(2896 /*GL_LIGHTING*/);
              var22 = 0.76F;
              GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F);
              GL11.glBlendFunc(768, 1);
              GL11.glMatrixMode(5890 /*GL_TEXTURE*/);
              GL11.glLoadIdentity();
              float var23 = var19 * (0.0010F + (float) var21 * 0.0030F) * 20.0F;
              float var24 = 0.33333334F;
              GL11.glScalef(var24, var24, var24);
              GL11.glRotatef(30.0F - (float) var21 * 60.0F, 0.0F, 0.0F, 1.0F);
              GL11.glTranslatef(0.0F, var23, 0.0F);
              GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
              this.renderPassModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);
            }

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glMatrixMode(5890 /*GL_TEXTURE*/);
            GL11.glDepthMask(true);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
            GL11.glEnable(2896 /*GL_LIGHTING*/);
            GL11.glDisable(3042 /*GL_BLEND*/);
            GL11.glDepthFunc(515);
          }

          GL11.glDisable(3042 /*GL_BLEND*/);
          GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        }
      }

      this.renderEquippedItems(var1, var9);
      float var26 = var1.getEntityBrightness(var9);
      var18 = this.getColorMultiplier(var1, var26, var9);
      OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapEnabled);
      GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
      OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapDisabled);
      if ((var18 >> 24 & 255) > 0 || var1.hurtTime > 0 || var1.deathTime > 0) {
        GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
        GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
        GL11.glEnable(3042 /*GL_BLEND*/);
        GL11.glBlendFunc(770, 771);
        GL11.glDepthFunc(514);
        if (var1.hurtTime > 0 || var1.deathTime > 0) {
          GL11.glColor4f(var26, 0.0F, 0.0F, 0.4F);
          this.mainModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);

          for (int var27 = 0; var27 < 4; ++var27) {
            if (this.inheritRenderPass(var1, var27, var9) >= 0) {
              GL11.glColor4f(var26, 0.0F, 0.0F, 0.4F);
              this.renderPassModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);
            }
          }
        }

        if ((var18 >> 24 & 255) > 0) {
          var19 = (float) (var18 >> 16 & 255) / 255.0F;
          var20 = (float) (var18 >> 8 & 255) / 255.0F;
          float var29 = (float) (var18 & 255) / 255.0F;
          var22 = (float) (var18 >> 24 & 255) / 255.0F;
          GL11.glColor4f(var19, var20, var29, var22);
          this.mainModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);

          for (int var28 = 0; var28 < 4; ++var28) {
            if (this.inheritRenderPass(var1, var28, var9) >= 0) {
              GL11.glColor4f(var19, var20, var29, var22);
              this.renderPassModel.render(var1, var16, var15, var13, var11 - var10, var12, var14);
            }
          }
        }

        GL11.glDepthFunc(515);
        GL11.glDisable(3042 /*GL_BLEND*/);
        GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
      }

      GL11.glDisable('\u803a');
    } catch (Exception var25) {
      var25.printStackTrace();
    }

    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapEnabled);
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapDisabled);
    GL11.glEnable(2884 /*GL_CULL_FACE*/);
    GL11.glPopMatrix();
    this.passSpecialRender(var1, var2, var4, var6);
  }