@Override
  public void onLivingUpdate() {
    this.rotationYaw = this.rotationPitch = this.prevRotationPitch = this.prevRotationYaw = 0;
    this.motionX = this.motionZ = 0D;
    this.motionY = -1D;
    super.onLivingUpdate();

    if (this.worldObj.isRemote) return;

    EntitySeeker seek;
    for (int i = 0; i < this.seekers.size(); i++) {
      seek = this.seekers.get(i);
      if (seek.isDead || seek.getHealth() <= 0 || this.getDistanceToEntity(seek) >= 32.0)
        this.seekers.remove(seek);
    }

    List<EntitySeeker> lst =
        this.worldObj.getEntitiesWithinAABB(
            EntitySeeker.class, this.getEntityBoundingBox().expand(32.0, 32.0, 32.0));

    for (EntitySeeker sk : lst) {
      if (sk.getOwner() == null) {
        sk.setOwner(this);
        this.seekers.add(sk);
      } else if (sk.getOwner() == this && !this.seekers.contains(sk)) {
        this.seekers.add(sk);
      }
    }

    if (this.seekers.isEmpty()
        && this.ticksExisted % 100 == 0
        && !TragicConfig.getBoolean("overlordPhases")) this.spawnSeekers();

    if (this.seekers.isEmpty()
        && this.getPhaseTicks() == 0
        && this.deathTime == 0
        && TragicConfig.getBoolean("overlordPhases")) this.setPhaseTicks(200);

    if (this.getPhaseTicks() > 0 && TragicConfig.getBoolean("overlordPhases")) {
      this.setPhaseTicks(this.getPhaseTicks() - 1);

      if (TragicConfig.getBoolean("overlordGas")) {
        List<BlockPos> lst2 =
            WorldHelper.getBlocksInSphericalRange(
                this.worldObj,
                3.5,
                this.posX + rand.nextInt(4) - rand.nextInt(4),
                this.posY,
                this.posZ + rand.nextInt(4) - rand.nextInt(4));
        for (BlockPos coords : lst2) {
          if (World.doesBlockHaveSolidTopSurface(this.worldObj, coords.down())
              && EntityOverlordCore.replaceableBlocks.contains(
                  this.worldObj.getBlockState(coords).getBlock())) {
            this.worldObj.setBlockState(coords, TragicBlocks.CorruptedGas.getDefaultState());
          }
        }
      }

      if (this.phaseChange) {
        this.phaseChange = false;
        this.setPhaseTicks(0);
        for (EntitySeeker sk : this.seekers) sk.setDead();
        this.spawnSeekers();
        this.phaseDamage = 0F;

        if (this.getHealth() > 0F) {
          float f = this.getMaxHealth() / 5;
          switch (this.getCurrentPhase()) {
            case 0:
              f *= 4;
              break;
            case 1:
              f *= 3;
              break;
            case 2:
              f *= 2;
              break;
            case 3:
              break;
            case 4:
              f = 0;
              break;
            default:
              break;
          }
          this.setHealth(f);
        }

        if (TragicConfig.getBoolean("allowDivinity")) {
          List<Entity> list =
              this.worldObj.getEntitiesWithinAABBExcludingEntity(
                  this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
          for (Entity e : list) {
            if (e instanceof EntityLivingBase
                && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
              ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
          }
        }
        if (TragicConfig.getBoolean("allowMobSounds"))
          this.worldObj.playSoundAtEntity(
              this, "tragicmc:boss.overlordcocoon.phasecomplete", 1.8F, 1.0F);
      } else {
        if (this.getPhaseTicks() == 199) {
          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && !((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e)
                    .addPotionEffect(new PotionEffect(TragicPotion.Divinity.id, 200));
            }
          }
        }

        if (this.getPhaseTicks() == 0) {
          if (this.getHealth() > 0F) {
            float f = this.getMaxHealth() / 5;
            switch (this.getCurrentPhase()) {
              case 0:
                f *= 5;
                break;
              case 1:
                f *= 4;
                break;
              case 2:
                f *= 3;
                break;
              case 3:
                f *= 2;
                break;
              case 4:
              default:
                break;
            }
            this.setHealth(f);
          }
          this.phaseDamage = 0F;

          for (EntitySeeker sk : this.seekers) sk.setDead();
          this.spawnSeekers();

          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
            }
          }

          if (TragicConfig.getBoolean("allowMobSounds"))
            this.worldObj.playSoundAtEntity(
                this, "tragicmc:boss.overlordcocoon.phasefail", 1.8F, 1.0F);
        }

        if (TragicConfig.getBoolean("allowMobSounds") && this.getPhaseTicks() % 10 == 0)
          this.worldObj.playSoundAtEntity(this, "tragicmc:boss.overlordcocoon.wah", 1.4F, 1.0F);
      }
    }
  }