Ejemplo n.º 1
0
 public boolean func_75250_a() {
   if (this.field_75267_a.func_70643_av() == null && !this.field_75267_a.func_70027_ad()) {
     return false;
   } else {
     Vec3 var1 = RandomPositionGenerator.func_75463_a(this.field_75267_a, 5, 4);
     if (var1 == null) {
       return false;
     } else {
       this.field_75266_c = var1.field_72450_a;
       this.field_75263_d = var1.field_72448_b;
       this.field_75264_e = var1.field_72449_c;
       return true;
     }
   }
 }
Ejemplo n.º 2
0
  /** Updates the task */
  public void updateTask() {
    playTime--;

    if (targetVillager != null) {
      if (villagerObj.getDistanceSqToEntity(targetVillager) > 4D) {
        villagerObj.getNavigator().tryMoveToEntityLiving(targetVillager, field_75261_c);
      }
    } else if (villagerObj.getNavigator().noPath()) {
      Vec3 vec3 = RandomPositionGenerator.func_75463_a(villagerObj, 16, 3);

      if (vec3 == null) {
        return;
      }

      villagerObj.getNavigator().tryMoveToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord, field_75261_c);
    }
  }
Ejemplo n.º 3
0
  /** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (villagerObj.getGrowingAge() >= 0) {
      return false;
    }

    if (villagerObj.getRNG().nextInt(400) != 0) {
      return false;
    }

    List list =
        villagerObj.worldObj.getEntitiesWithinAABB(
            net.minecraft.src.EntityVillager.class, villagerObj.boundingBox.expand(6D, 3D, 6D));
    double d = Double.MAX_VALUE;
    Iterator iterator = list.iterator();

    do {
      if (!iterator.hasNext()) {
        break;
      }

      EntityVillager entityvillager = (EntityVillager) iterator.next();

      if (entityvillager != villagerObj
          && !entityvillager.isPlaying()
          && entityvillager.getGrowingAge() < 0) {
        double d1 = entityvillager.getDistanceSqToEntity(villagerObj);

        if (d1 <= d) {
          d = d1;
          targetVillager = entityvillager;
        }
      }
    } while (true);

    if (targetVillager == null) {
      Vec3 vec3 = RandomPositionGenerator.func_75463_a(villagerObj, 16, 3);

      if (vec3 == null) {
        return false;
      }
    }

    return true;
  }