content: package net.minecraft.entity.ai;
  
  import net.minecraft.entity.passive.EntityAnimal;
  
  import java.util.List;
  
  public class EntityAIFollowParent extends EntityAIBase {
      EntityAnimal childAnimal;
      EntityAnimal parentAnimal;
      double moveSpeed;
      private int delayCounter;
  
      public EntityAIFollowParent(EntityAnimal animal, double speed) {
          this.childAnimal = animal;
          this.moveSpeed = speed;
      }
  
      public boolean shouldExecute() {
          if (this.childAnimal.getGrowingAge() >= 0) {
              return false;
          } else {
              List<EntityAnimal> list = this.childAnimal.worldObj.getEntitiesWithinAABB(this.childAnimal.getClass(), this.childAnimal.getEntityBoundingBox().expand(8.0D, 4.0D, 8.0D));
              EntityAnimal entityanimal = null;
              double d0 = Double.MAX_VALUE;
  
              for (EntityAnimal entityanimal1 : list) {
                  if (entityanimal1.getGrowingAge() >= 0) {
                      double d1 = this.childAnimal.getDistanceSqToEntity(entityanimal1);
  
                      if (d1 <= d0) {
                          d0 = d1;
                          entityanimal = entityanimal1;
                      }
                  }
              }
  
              if (entityanimal == null) {
                  return false;
              } else if (d0 < 9.0D) {
                  return false;
              } else {
                  this.parentAnimal = entityanimal;
                  return true;
              }
          }
      }
  
      public boolean continueExecuting() {
          if (this.childAnimal.getGrowingAge() >= 0) {
              return false;
          } else if (!this.parentAnimal.isEntityAlive()) {
              return false;
          } else {
              double d0 = this.childAnimal.getDistanceSqToEntity(this.parentAnimal);
              return d0 >= 9.0D && d0 <= 256.0D;
          }
      }
  
      public void startExecuting() {
          this.delayCounter = 0;
      }
  
      public void resetTask() {
          this.parentAnimal = null;
      }
  
      public void updateTask() {
          if (--this.delayCounter <= 0) {
              this.delayCounter = 10;
              this.childAnimal.getNavigator().tryMoveToEntityLiving(this.parentAnimal, this.moveSpeed);
          }
      }
  }
  