/** Called to update the entity's position/logic. */
  public void onUpdate() {
    super.onUpdate();

    if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
      float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
      this.prevRotationYaw =
          this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
      this.prevRotationPitch =
          this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI);
    }

    Block i = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);

    if (!i.equals(Blocks.air)) {
      i.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);
      AxisAlignedBB axisalignedbb =
          i.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);

      if (axisalignedbb != null
          && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
        this.inGround = true;
      }
    }

    if (this.arrowShake > 0) {
      --this.arrowShake;
    }

    if (this.inGround) {
      Block j = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
      int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);

      if (j == this.inTile && k == this.inData) {
        ++this.ticksInGround;

        if (this.ticksInGround == 1200) {
          this.setDead();
        }
      } else {
        this.inGround = false;
        this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
        this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
        this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
        this.ticksInGround = 0;
        this.ticksInAir = 0;
      }
    } else {
      ++this.ticksInAir;
      Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
      Vec3 vec3 =
          Vec3.createVectorHelper(
              this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
      MovingObjectPosition movingobjectposition =
          this.worldObj.func_147447_a(vec31, vec3, false, true, false);
      vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
      vec3 =
          Vec3.createVectorHelper(
              this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

      if (movingobjectposition != null) {
        vec31 =
            Vec3.createVectorHelper(
                movingobjectposition.hitVec.xCoord,
                movingobjectposition.hitVec.yCoord,
                movingobjectposition.hitVec.zCoord);
      }

      Entity entity = null;
      List list =
          this.worldObj.getEntitiesWithinAABBExcludingEntity(
              this,
              this.boundingBox
                  .addCoord(this.motionX, this.motionY, this.motionZ)
                  .expand(1.0D, 1.0D, 1.0D));
      double d0 = 0.0D;
      int l;
      float f1;

      for (l = 0; l < list.size(); ++l) {
        Entity entity1 = (Entity) list.get(l);

        if (entity1.canBeCollidedWith()
            && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
          f1 = 0.3F;
          AxisAlignedBB axisalignedbb1 =
              entity1.boundingBox.expand((double) f1, (double) f1, (double) f1);
          MovingObjectPosition movingobjectposition1 =
              axisalignedbb1.calculateIntercept(vec3, vec31);

          if (movingobjectposition1 != null) {
            double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

            if (d1 < d0 || d0 == 0.0D) {
              entity = entity1;
              d0 = d1;
            }
          }
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }

      if (movingobjectposition != null
          && movingobjectposition.entityHit != null
          && movingobjectposition.entityHit instanceof EntityPlayer) {
        EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;

        if (entityplayer.capabilities.disableDamage
            || this.shootingEntity instanceof EntityPlayer
                && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
          movingobjectposition = null;
        }
      }

      float f2;
      float f3;

      if (movingobjectposition != null) {
        if (movingobjectposition.entityHit != null) {
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          int i1 = MathHelper.ceiling_double_int((double) f2 * this.damage);

          if (this.getIsCritical()) {
            i1 += this.rand.nextInt(i1 / 2 + 2);
          }

          DamageSource damagesource = null;

          if (this.shootingEntity == null) {
            damagesource = mod_Rediscovered.causeParrowDamage(this, this);
          } else {
            damagesource = mod_Rediscovered.causeParrowDamage(this, this.shootingEntity);
          }

          if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
            movingobjectposition.entityHit.setFire(5);
          }

          if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float) i1)) {
            if (movingobjectposition.entityHit instanceof EntityLivingBase) {
              EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit;

              if (!this.worldObj.isRemote) {
                entitylivingbase.setArrowCountInEntity(
                    entitylivingbase.getArrowCountInEntity() + 1);
              }

              if (this.knockbackStrength > 0) {
                f3 =
                    MathHelper.sqrt_double(
                        this.motionX * this.motionX + this.motionZ * this.motionZ);

                if (f3 > 0.0F) {
                  movingobjectposition.entityHit.addVelocity(
                      this.motionX
                          * (double) this.knockbackStrength
                          * 0.6000000238418579D
                          / (double) f3,
                      0.1D,
                      this.motionZ
                          * (double) this.knockbackStrength
                          * 0.6000000238418579D
                          / (double) f3);
                }
              }
            }

            this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));

            if (!(movingobjectposition.entityHit instanceof EntityEnderman)) {
              this.setDead();
            }
          } else {
            this.motionX *= -0.10000000149011612D;
            this.motionY *= -0.10000000149011612D;
            this.motionZ *= -0.10000000149011612D;
            this.rotationYaw += 180.0F;
            this.prevRotationYaw += 180.0F;
            this.ticksInAir = 0;
          }
        } else {
          this.xTile = movingobjectposition.blockX;
          this.yTile = movingobjectposition.blockY;
          this.zTile = movingobjectposition.blockZ;
          this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
          this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
          this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX));
          this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY));
          this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          this.posX -= this.motionX / (double) f2 * 0.05000000074505806D;
          this.posY -= this.motionY / (double) f2 * 0.05000000074505806D;
          this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D;
          this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
          this.inGround = true;
          this.arrowShake = 7;
          this.setIsCritical(false);

          if (!this.inTile.equals(Blocks.air)) {
            this.inTile.onEntityCollidedWithBlock(
                this.worldObj, this.xTile, this.yTile, this.zTile, this);
          }
        }
      }

      if (this.getIsCritical()) {
        for (l = 0; l < 4; ++l) {
          this.worldObj.spawnParticle(
              "crit",
              this.posX + this.motionX * (double) l / 4.0D,
              this.posY + this.motionY * (double) l / 4.0D,
              this.posZ + this.motionZ * (double) l / 4.0D,
              -this.motionX,
              -this.motionY + 0.2D,
              -this.motionZ);
        }
      }

      this.posX += this.motionX;
      this.posY += this.motionY;
      this.posZ += this.motionZ;
      f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
      this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

      for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f2) * 180.0D / Math.PI);
          this.rotationPitch - this.prevRotationPitch < -180.0F;
          this.prevRotationPitch -= 360.0F) {;
      }

      while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
        this.prevRotationPitch += 360.0F;
      }

      while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
        this.prevRotationYaw -= 360.0F;
      }

      while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
        this.prevRotationYaw += 360.0F;
      }

      this.rotationPitch =
          this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
      this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
      float f4 = 0.99F;
      f1 = 0.05F;

      if (this.isInWater()) {
        for (int j1 = 0; j1 < 4; ++j1) {
          f3 = 0.25F;
          this.worldObj.spawnParticle(
              "bubble",
              this.posX - this.motionX * (double) f3,
              this.posY - this.motionY * (double) f3,
              this.posZ - this.motionZ * (double) f3,
              this.motionX,
              this.motionY,
              this.motionZ);
        }

        f4 = 0.8F;
      }

      this.motionX *= (double) f4;
      this.motionY *= (double) f4;
      this.motionZ *= (double) f4;
      this.motionY -= (double) f1;
      this.setPosition(this.posX, this.posY, this.posZ);
      //            this.doBlockCollisions();
    }
  }
  // @Override
  @Override
  public void onUpdate() {
    super.onUpdate();

    if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
      float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
      this.prevRotationYaw =
          this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
      // this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) *
      // 180.0D / Math.PI);
    }

    Block block =
        this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);

    if (block.getMaterial() != Material.air) {
      block.setBlockBoundsBasedOnState(
          this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
      AxisAlignedBB axisalignedbb =
          block.getCollisionBoundingBoxFromPool(
              this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);

      if (axisalignedbb != null
          && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
        this.inGround = true;
      }
    }

    if (this.arrowShake > 0) {
      --this.arrowShake;
    }

    if (this.inGround) {
      /*int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);

      if (block == this.field_145790_g && j == this.inData)
      {
          ++this.ticksInGround;

          if (this.ticksInGround == 1200)
          {
              this.setDead();
          }
      }
      else
      {
          this.inGround = false;
          this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
          this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
          this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
          this.ticksInGround = 0;
          this.ticksInAir = 0;
      }*/

      if (!this.worldObj.isRemote) {
        this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
        ExplosionChaos.burn(this.worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, 10);
        ExplosionChaos.flameDeath(
            this.worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, 20);
        ExplosionNukeGeneric.waste(
            this.worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, 20);
        ExplosionChaos.poison(this.worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, 20);
      }
      this.worldObj.spawnEntityInWorld(
          new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ));
      this.setDead();
    } else {
      ++this.ticksInAir;
      Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
      Vec3 vec3 =
          Vec3.createVectorHelper(
              this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
      MovingObjectPosition movingobjectposition =
          this.worldObj.func_147447_a(vec31, vec3, false, true, false);
      vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
      vec3 =
          Vec3.createVectorHelper(
              this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

      if (movingobjectposition != null) {
        vec3 =
            Vec3.createVectorHelper(
                movingobjectposition.hitVec.xCoord,
                movingobjectposition.hitVec.yCoord,
                movingobjectposition.hitVec.zCoord);
      }

      Entity entity = null;
      List list =
          this.worldObj.getEntitiesWithinAABBExcludingEntity(
              this,
              this.boundingBox
                  .addCoord(this.motionX, this.motionY, this.motionZ)
                  .expand(1.0D, 1.0D, 1.0D));
      double d0 = 0.0D;
      int i;
      float f1;

      for (i = 0; i < list.size(); ++i) {
        Entity entity1 = (Entity) list.get(i);

        if (entity1.canBeCollidedWith()
            && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
          f1 = 0.3F;
          AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
          MovingObjectPosition movingobjectposition1 =
              axisalignedbb1.calculateIntercept(vec31, vec3);

          if (movingobjectposition1 != null) {
            double d1 = vec31.distanceTo(movingobjectposition1.hitVec);

            if (d1 < d0 || d0 == 0.0D) {
              entity = entity1;
              d0 = d1;
            }
          }
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }

      if (movingobjectposition != null
          && movingobjectposition.entityHit != null
          && movingobjectposition.entityHit instanceof EntityPlayer) {
        EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;

        if (entityplayer.capabilities.disableDamage
            || this.shootingEntity instanceof EntityPlayer
                && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
          movingobjectposition = null;
        }
      }

      float f2;
      float f4;

      if (movingobjectposition != null) {
        if (movingobjectposition.entityHit != null) {
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          int k = MathHelper.ceiling_double_int(f2 * this.damage);

          if (this.getIsCritical()) {
            k += this.rand.nextInt(k / 2 + 2);
          }

          DamageSource damagesource = null;

          if (this.shootingEntity == null) {
            damagesource = DamageSource.causeIndirectMagicDamage(this, this);
          } else {
            damagesource = DamageSource.causeIndirectMagicDamage(this, this);
          }

          if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
            movingobjectposition.entityHit.setFire(5);
          }

          if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) {
            if (movingobjectposition.entityHit instanceof EntityLivingBase) {
              EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit;

              if (!this.worldObj.isRemote) {
                entitylivingbase.setArrowCountInEntity(
                    entitylivingbase.getArrowCountInEntity() + 1);
              }

              if (this.knockbackStrength > 0) {
                f4 =
                    MathHelper.sqrt_double(
                        this.motionX * this.motionX + this.motionZ * this.motionZ);

                if (f4 > 0.0F) {
                  movingobjectposition.entityHit.addVelocity(
                      this.motionX * this.knockbackStrength * 0.6000000238418579D / f4,
                      0.1D,
                      this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
                }
              }

              if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) {
                EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
                EnchantmentHelper.func_151385_b(
                    (EntityLivingBase) this.shootingEntity, entitylivingbase);
              }

              if (this.shootingEntity != null
                  && movingobjectposition.entityHit != this.shootingEntity
                  && movingobjectposition.entityHit instanceof EntityPlayer
                  && this.shootingEntity instanceof EntityPlayerMP) {
                ((EntityPlayerMP) this.shootingEntity)
                    .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
              }
            }

            if (!(movingobjectposition.entityHit instanceof EntityEnderman)) {
              if (!this.worldObj.isRemote) {
                this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
              }
              this.setDead();
            }
          } else {
            this.motionX *= -0.10000000149011612D;
            this.motionY *= -0.10000000149011612D;
            this.motionZ *= -0.10000000149011612D;
            this.rotationYaw += 180.0F;
            this.prevRotationYaw += 180.0F;
            this.ticksInAir = 0;
          }
        } else {
          this.field_145791_d = movingobjectposition.blockX;
          this.field_145792_e = movingobjectposition.blockY;
          this.field_145789_f = movingobjectposition.blockZ;
          this.field_145790_g =
              this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
          this.inData =
              this.worldObj.getBlockMetadata(
                  this.field_145791_d, this.field_145792_e, this.field_145789_f);
          this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX));
          this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY));
          this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          this.posX -= this.motionX / f2 * 0.05000000074505806D;
          this.posY -= this.motionY / f2 * 0.05000000074505806D;
          this.posZ -= this.motionZ / f2 * 0.05000000074505806D;
          this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
          this.inGround = true;
          this.arrowShake = 7;
          this.setIsCritical(false);

          if (this.field_145790_g.getMaterial() != Material.air) {
            this.field_145790_g.onEntityCollidedWithBlock(
                this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
          }
        }
      }

      if (true) {
        for (i = 0; i < 4; ++i) {
          this.worldObj.spawnParticle(
              "smoke",
              this.posX,
              this.posY,
              this.posZ,
              0,
              0,
              0 /*this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ*/);
        }
      }

      this.posX += this.motionX;
      this.posY += this.motionY;
      this.posZ += this.motionZ;
      f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
      this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

      // for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI);
      // this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
      {;
      }

      /*while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
      {
          this.prevRotationPitch += 360.0F;
      }

      while (this.rotationYaw - this.prevRotationYaw < -180.0F)
      {
          this.prevRotationYaw -= 360.0F;
      }

      while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
      {
          this.prevRotationYaw += 360.0F;
      }*/

      // this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch)
      // * 0.2F;
      // this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
      float f3 = 0.99F;
      f1 = 0.05F;

      if (this.isInWater()) {
        for (int l = 0; l < 4; ++l) {
          f4 = 0.25F;
          this.worldObj.spawnParticle(
              "bubble",
              this.posX - this.motionX * f4,
              this.posY - this.motionY * f4,
              this.posZ - this.motionZ * f4,
              this.motionX,
              this.motionY,
              this.motionZ);
        }

        f3 = 0.8F;
      }

      if (this.isWet()) {
        this.extinguish();
      }

      this.motionX *= f3;
      this.motionY *= f3;
      this.motionZ *= f3;
      this.motionY -= gravity;
      this.setPosition(this.posX, this.posY, this.posZ);
      this.func_145775_I();
    }
  }
  @Override
  @SuppressWarnings("unchecked")
  public void onUpdate() {
    super.onUpdate();

    if (this.ticksExisted > 400) {
      if (this.isHot) {
        this.isHot = false;
        this.setHot(this.isHot);
      }
    } else if (!this.worldObj.isRemote) {
      this.setHot(this.isHot);
    }

    if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
      float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
      this.prevRotationYaw =
          this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
      this.prevRotationPitch =
          this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI);
    }

    BlockPos pos = new BlockPos(this.xTile, this.yTile, this.zTile);
    Block block = this.worldObj.getBlockState(pos).getBlock();

    if (!block.isAir(this.worldObj, pos)) {
      block.setBlockBoundsBasedOnState(this.worldObj, pos);
      AxisAlignedBB axisalignedbb =
          block.getCollisionBoundingBox(this.worldObj, pos, this.worldObj.getBlockState(pos));

      if (axisalignedbb != null
          && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) {
        this.inGround = true;
      }
    }

    if (this.inGround) {
      Block j = this.worldObj.getBlockState(pos).getBlock();
      int k = j.getMetaFromState(this.worldObj.getBlockState(pos));

      if (j == this.inTile && k == this.inData) {
        ++this.ticksInGround;

        if (this.ticksInGround == 1200) {
          this.setDead();
        }
      } else {
        this.inGround = false;
        this.motionX *= this.rand.nextFloat() * 0.2F;
        this.motionY *= this.rand.nextFloat() * 0.2F;
        this.motionZ *= this.rand.nextFloat() * 0.2F;
        this.ticksInGround = 0;
        this.ticksInAir = 0;
      }
    } else {
      ++this.ticksInAir;
      Vec3 vec3 = new Vec3(this.posX, this.posY, this.posZ);
      Vec3 vec31 =
          new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
      MovingObjectPosition movingobjectposition =
          this.worldObj.rayTraceBlocks(vec3, vec31, false, true, false);
      vec3 = new Vec3(this.posX, this.posY, this.posZ);
      vec31 =
          new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

      if (movingobjectposition != null) {
        vec31 =
            new Vec3(
                movingobjectposition.hitVec.xCoord,
                movingobjectposition.hitVec.yCoord,
                movingobjectposition.hitVec.zCoord);
      }

      this.rotationPitch += 1F;

      Entity entity = null;
      List<Entity> list =
          this.worldObj.getEntitiesWithinAABBExcludingEntity(
              this,
              this.getEntityBoundingBox()
                  .addCoord(this.motionX, this.motionY, this.motionZ)
                  .expand(1.0D, 1.0D, 1.0D));
      double d0 = 0.0D;
      int l;
      float f1;

      for (l = 0; l < list.size(); ++l) {
        Entity entity1 = list.get(l);

        if (entity1.canBeCollidedWith()
            && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
          f1 = 0.3F;
          AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand(f1, f1, f1);
          MovingObjectPosition movingobjectposition1 =
              axisalignedbb1.calculateIntercept(vec3, vec31);

          if (movingobjectposition1 != null) {
            double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

            if (d1 < d0 || d0 == 0.0D) {
              entity = entity1;
              d0 = d1;
            }
          }
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }

      if (movingobjectposition != null
          && movingobjectposition.entityHit != null
          && movingobjectposition.entityHit instanceof EntityPlayer) {
        EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;

        if (entityplayer.capabilities.disableDamage
            || this.shootingEntity instanceof EntityPlayer
                && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
          movingobjectposition = null;
        }
      }

      float f2;
      float f3;
      double damage = ConfigManagerCore.hardMode ? 3.2D : 1.6D;

      if (movingobjectposition != null) {
        if (movingobjectposition.entityHit != null) {
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          int i1 = MathHelper.ceiling_double_int(f2 * damage);

          DamageSource damagesource = null;

          if (this.shootingEntity == null) {
            damagesource =
                new EntityDamageSourceIndirect("meteorChunk", this, this).setProjectile();
          } else {
            damagesource =
                new EntityDamageSourceIndirect("meteorChunk", this, this.shootingEntity)
                    .setProjectile();
          }

          if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
            movingobjectposition.entityHit.setFire(2);
          }

          if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1)) {
            if (movingobjectposition.entityHit instanceof EntityLivingBase) {
              EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit;

              if (!this.worldObj.isRemote) {
                entitylivingbase.setArrowCountInEntity(
                    entitylivingbase.getArrowCountInEntity() + 1);
              }

              if (this.knockbackStrength > 0) {
                f3 =
                    MathHelper.sqrt_double(
                        this.motionX * this.motionX + this.motionZ * this.motionZ);

                if (f3 > 0.0F) {
                  movingobjectposition.entityHit.addVelocity(
                      this.motionX * this.knockbackStrength * 0.6000000238418579D / f3,
                      0.1D,
                      this.motionZ * this.knockbackStrength * 0.6000000238418579D / f3);
                }
              }

              if (this.shootingEntity != null) {
                EnchantmentHelper.applyThornEnchantments(entitylivingbase, this.shootingEntity);
                EnchantmentHelper.applyArthropodEnchantments(
                    (EntityLivingBase) this.shootingEntity, entitylivingbase);
              }

              if (this.shootingEntity != null
                  && movingobjectposition.entityHit != this.shootingEntity
                  && movingobjectposition.entityHit instanceof EntityPlayer
                  && this.shootingEntity instanceof EntityPlayerMP) {
                ((EntityPlayerMP) this.shootingEntity)
                    .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
              }
            }

            if (!(movingobjectposition.entityHit instanceof EntityEnderman)) {
              this.setDead();
            }
          } else {
            this.motionX *= -0.10000000149011612D;
            this.motionY *= -0.10000000149011612D;
            this.motionZ *= -0.10000000149011612D;
            this.rotationYaw += 180.0F;
            this.prevRotationYaw += 180.0F;
            this.ticksInAir = 0;
          }
        } else {
          this.xTile = movingobjectposition.getBlockPos().getX();
          this.yTile = movingobjectposition.getBlockPos().getY();
          this.zTile = movingobjectposition.getBlockPos().getZ();
          IBlockState state = this.worldObj.getBlockState(movingobjectposition.getBlockPos());
          this.inTile = state.getBlock();
          this.inData = this.inTile.getMetaFromState(state);
          this.motionX = (float) (movingobjectposition.hitVec.xCoord - this.posX);
          this.motionY = (float) (movingobjectposition.hitVec.yCoord - this.posY);
          this.motionZ = (float) (movingobjectposition.hitVec.zCoord - this.posZ);
          f2 =
              MathHelper.sqrt_double(
                  this.motionX * this.motionX
                      + this.motionY * this.motionY
                      + this.motionZ * this.motionZ);
          this.posX -= this.motionX / f2 * 0.05000000074505806D;
          this.posY -= this.motionY / f2 * 0.05000000074505806D;
          this.posZ -= this.motionZ / f2 * 0.05000000074505806D;
          this.inGround = true;

          if (!this.inTile.isAir(this.worldObj, movingobjectposition.getBlockPos())) {
            this.inTile.onEntityCollidedWithBlock(
                this.worldObj, movingobjectposition.getBlockPos(), this);
          }
        }
      }

      this.posX += this.motionX;
      this.posY += this.motionY;
      this.posZ += this.motionZ;
      f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

      if (!this.onGround) {
        this.rotationPitch += 10;
        this.rotationYaw += 2;
      }

      float f4 = 0.99F;
      f1 = 0.05F;

      if (this.isInWater()) {
        for (int j1 = 0; j1 < 4; ++j1) {
          f3 = 0.25F;
          this.worldObj.spawnParticle(
              EnumParticleTypes.WATER_BUBBLE,
              this.posX - this.motionX * f3,
              this.posY - this.motionY * f3,
              this.posZ - this.motionZ * f3,
              this.motionX,
              this.motionY,
              this.motionZ);
        }

        f4 = 0.8F;
      }

      this.motionX *= f4;
      this.motionY *= f4;
      this.motionZ *= f4;
      this.motionY -= WorldUtil.getGravityForEntity(this);
      this.setPosition(this.posX, this.posY, this.posZ);
      this.doBlockCollisions();
    }
  }