public PacketEntitySetPositionAndRotation(Entity entity) {
   super(entity.getEntityID());
   this.x = M.floor(entity.x * 32.0D);
   this.y = M.floor(entity.y * 32.0D);
   this.z = M.floor(entity.z * 32.0D);
   this.yaw = (byte) ((int) (entity.yaw * 256.0F / 360.0F));
   this.pitch = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
   this.onGround = entity.onGround;
 }
Пример #2
0
 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);
   }
 }
Пример #3
0
  public void updateAnimation() {
    if (!this.framesTextureData.isEmpty()) {
      Minecraft var1 = Minecraft.getMinecraft();
      double var2 = 0.0D;

      if (var1.world != null && var1.player != null) {
        float var4 = var1.world.getCelestialAngle(1.0F);
        var2 = (double) var4;

        if (!var1.world.provider.isOverworld()) {
          var2 = Math.random();
        }
      }

      double var7;

      for (var7 = var2 - this.field_94239_h; var7 < -0.5D; ++var7) {;
      }

      while (var7 >= 0.5D) {
        --var7;
      }

      var7 = M.clamp(var7, -1.0D, 1.0D);
      this.field_94240_i += var7 * 0.1D;
      this.field_94240_i *= 0.8D;
      this.field_94239_h += this.field_94240_i;
      int var6;

      for (var6 =
              (int) ((this.field_94239_h + 1.0D) * (double) this.framesTextureData.size())
                  % this.framesTextureData.size();
          var6 < 0;
          var6 = (var6 + this.framesTextureData.size()) % this.framesTextureData.size()) {;
      }

      if (var6 != this.frameCounter) {
        this.frameCounter = var6;
        TextureUtil.uploadTextureMipmap(
            (int[][]) this.framesTextureData.get(this.frameCounter),
            this.width,
            this.height,
            this.originX,
            this.originY,
            false,
            false);
      }
    }
  }
Пример #4
0
  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();
    }
  }