/** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (this.dino instanceof EntityNewPrehistoric) {
      EntityNewPrehistoric prehistoric = (EntityNewPrehistoric) dino;
      if (prehistoric.aiResponseType() != Response.TERRITORIAL) {
        return false;
      }
    }
    if (this.dino.preyBlacklist().contains(targetEntityClass)) {
      return false;
    }
    if (closestLivingEntity != null) {
      if (targetEntityClass == closestLivingEntity.getClass()
          && targetEntityClass != dino.getClass()) {
        if (closestLivingEntity.boundingBox.maxX * 1.5F < dino.boundingBox.maxX
            && closestLivingEntity.boundingBox.minX * 1.5F > dino.boundingBox.minX
            && closestLivingEntity.boundingBox.minZ * 1.5F < dino.boundingBox.minZ
            && closestLivingEntity.boundingBox.minZ * 1.5F > dino.boundingBox.minZ) {
          return false;
        }
      }
    }
    if (this.targetEntityClass == EntityPlayer.class) {
      if (this.dino instanceof EntityTameable && ((EntityTameable) this.dino).isTamed()) {
        return false;
      }

      this.closestLivingEntity =
          this.dino.worldObj.getClosestPlayerToEntity(this.dino, (double) this.distanceFromEntity);

      if (this.closestLivingEntity == null) {
        return false;
      }

    } else {
      List list =
          this.dino.worldObj.selectEntitiesWithinAABB(
              this.targetEntityClass,
              this.dino.boundingBox.expand(
                  (double) this.distanceFromEntity, 3.0D, (double) this.distanceFromEntity),
              this.selector);

      if (list.isEmpty()) {
        return false;
      }

      this.closestLivingEntity = (Entity) list.get(0);
    }
    if (closestLivingEntity.getClass() == targetEntityClass) {
      return true;
    } else {
      return false;
    }
  }
 public DinoAITerratorial(
     EntityNewPrehistoric creature, Class<? extends Entity> target, float distance) {
   this.dino = creature;
   this.targetEntityClass = target;
   this.distanceFromEntity = distance;
   this.entityPathNavigate = creature.getNavigator();
   this.setMutexBits(1);
 }
 /** Execute a one shot task or start executing a continuous task */
 public void startExecuting() {
   dino.setAttackTarget((EntityLiving) closestLivingEntity);
 }