public float getHeadRotationAngleX(float p_70890_1_) {
   if (this.sheepTimer > 4 && this.sheepTimer <= 36) {
     float var2 = ((float) (this.sheepTimer - 4) - p_70890_1_) / 32.0F;
     return ((float) Math.PI / 5F) + ((float) Math.PI * 7F / 100F) * M.sin(var2 * 28.7F);
   } else {
     return this.sheepTimer > 0 ? ((float) Math.PI / 5F) : this.pitch / (180F / (float) Math.PI);
   }
 }
  public void doRenderLayer(
      AbstractClientPlayer p_177166_1_,
      float p_177166_2_,
      float p_177166_3_,
      float p_177166_4_,
      float p_177166_5_,
      float p_177166_6_,
      float p_177166_7_,
      float p_177166_8_) {
    if (p_177166_1_.hasCape()
        && !p_177166_1_.isInvisible()
        && p_177166_1_.func_175148_a(EnumPlayerModelParts.CAPE)
        && p_177166_1_.getLocationCape() != null) {
      GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
      this.playerRenderer.bindTexture(p_177166_1_.getLocationCape());
      GlStateManager.pushMatrix();
      GlStateManager.translate(0.0F, 0.0F, 0.125F);
      double var9 =
          p_177166_1_.field_71091_bM
              + (p_177166_1_.field_71094_bP - p_177166_1_.field_71091_bM) * (double) p_177166_4_
              - (p_177166_1_.prevX + (p_177166_1_.x - p_177166_1_.prevX) * (double) p_177166_4_);
      double var11 =
          p_177166_1_.field_71096_bN
              + (p_177166_1_.field_71095_bQ - p_177166_1_.field_71096_bN) * (double) p_177166_4_
              - (p_177166_1_.prevY + (p_177166_1_.y - p_177166_1_.prevY) * (double) p_177166_4_);
      double var13 =
          p_177166_1_.field_71097_bO
              + (p_177166_1_.field_71085_bR - p_177166_1_.field_71097_bO) * (double) p_177166_4_
              - (p_177166_1_.prevZ + (p_177166_1_.z - p_177166_1_.prevZ) * (double) p_177166_4_);
      float var15 =
          p_177166_1_.prevRenderYawOffset
              + (p_177166_1_.renderYawOffset - p_177166_1_.prevRenderYawOffset) * p_177166_4_;
      double var16 = M.sin(var15 * (float) Math.PI / 180.0F);
      double var18 = (double) (-M.cos(var15 * (float) Math.PI / 180.0F));
      float var20 = (float) var11 * 10.0F;
      var20 = M.clamp(var20, -6.0F, 32.0F);
      float var21 = (float) (var9 * var16 + var13 * var18) * 100.0F;
      float var22 = (float) (var9 * var18 - var13 * var16) * 100.0F;

      if (var21 < 0.0F) {
        var21 = 0.0F;
      }

      float var23 =
          p_177166_1_.prevCameraYaw
              + (p_177166_1_.cameraYaw - p_177166_1_.prevCameraYaw) * p_177166_4_;
      var20 +=
          M.sin(
                  (p_177166_1_.prevDistanceWalkedModified
                          + (p_177166_1_.distanceWalkedModified
                                  - p_177166_1_.prevDistanceWalkedModified)
                              * p_177166_4_)
                      * 6.0F)
              * 32.0F
              * var23;

      if (p_177166_1_.isSneaking()) {
        var20 += 25.0F;
      }

      GlStateManager.rotate(6.0F + var21 / 2.0F + var20, 1.0F, 0.0F, 0.0F);
      GlStateManager.rotate(var22 / 2.0F, 0.0F, 0.0F, 1.0F);
      GlStateManager.rotate(-var22 / 2.0F, 0.0F, 1.0F, 0.0F);
      GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
      this.playerRenderer.func_177136_g().func_178728_c(0.0625F);
      GlStateManager.popMatrix();
    }
  }