Пример #1
0
 protected void jump() {
   super.jump();
   addStat(StatList.jumpStat, 1);
   if (isSprinting()) {
     addExhaustion(0.8F);
   } else {
     addExhaustion(0.2F);
   }
 }
 public void onLivingUpdate() {
   if (field_9324_Y > 0) {
     double d = posX + (field_9323_Z - posX) / (double) field_9324_Y;
     double d1 = posY + (field_9356_aa - posY) / (double) field_9324_Y;
     double d2 = posZ + (field_9354_ab - posZ) / (double) field_9324_Y;
     double d3;
     for (d3 = field_9352_ac - (double) rotationYaw; d3 < -180D; d3 += 360D) {}
     for (; d3 >= 180D; d3 -= 360D) {}
     rotationYaw += d3 / (double) field_9324_Y;
     rotationPitch += (field_9350_ad - (double) rotationPitch) / (double) field_9324_Y;
     field_9324_Y--;
     setPosition(d, d1, d2);
     setRotation(rotationYaw, rotationPitch);
   }
   if (func_22049_v()) {
     isJumping = false;
     moveStrafing = 0.0F;
     moveForward = 0.0F;
     randomYawVelocity = 0.0F;
   } else if (!field_9343_G) {
     updatePlayerActionState();
   }
   boolean flag = handleWaterMovement();
   boolean flag1 = handleLavaMovement();
   if (isJumping) {
     if (flag) {
       motionY += 0.039999999105930328D;
     } else if (flag1) {
       motionY += 0.039999999105930328D;
     } else if (onGround) {
       jump();
     }
   }
   moveStrafing *= 0.98F;
   moveForward *= 0.98F;
   randomYawVelocity *= 0.9F;
   moveEntityWithHeading(moveStrafing, moveForward);
   if (this.health > 0) {
     List list =
         worldObj.getEntitiesWithinAABBExcludingEntity(
             this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
     if (list != null && list.size() > 0) {
       for (int i = 0; i < list.size(); i++) {
         Entity entity = (Entity) list.get(i);
         if (entity.canBePushed()) {
           entity.applyEntityCollision(this);
         }
       }
     }
   }
 }