/** Called to update the entity's position/logic. */
  @Override
  public void onUpdate() {
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;

    if (this.materialType == GCMarsBlocks.bacterialSludge) {
      this.particleRed = 0.1F;
      this.particleGreen = 0.1F;
      this.particleBlue = 0.1F;
    } else {
      this.particleRed = 1.0F;
      this.particleGreen = 16.0F / (40 - this.bobTimer + 16);
      this.particleBlue = 4.0F / (40 - this.bobTimer + 8);
    }

    this.motionY -= this.particleGravity;

    if (this.bobTimer-- > 0) {
      this.motionX *= 0.02D;
      this.motionY *= 0.02D;
      this.motionZ *= 0.02D;
      this.setParticleTextureIndex(113);
    } else {
      this.setParticleTextureIndex(112);
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.9800000190734863D;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= 0.9800000190734863D;

    if (this.particleMaxAge-- <= 0) {
      this.setDead();
    }

    if (this.onGround) {
      if (this.materialType == Material.water) {
        this.setDead();
        this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
      } else {
        this.setParticleTextureIndex(114);
      }

      this.motionX *= 0.699999988079071D;
      this.motionZ *= 0.699999988079071D;
    }

    final Material var1 =
        this.worldObj.getBlockMaterial(
            MathHelper.floor_double(this.posX),
            MathHelper.floor_double(this.posY),
            MathHelper.floor_double(this.posZ));

    if (var1.isLiquid() || var1.isSolid()) {
      final double var2 =
          MathHelper.floor_double(this.posY)
              + 1
              - BlockFluid.getFluidHeightPercent(
                  this.worldObj.getBlockMetadata(
                      MathHelper.floor_double(this.posX),
                      MathHelper.floor_double(this.posY),
                      MathHelper.floor_double(this.posZ)));

      if (this.posY < var2) {
        this.setDead();
      }
    }
  }