/** Updates the task */
  public void updateTask() {
    theVillager.getLookHelper().setLookPositionWithEntity(theGolem, 30F, 30F);

    if (theGolem.func_48382_m_() == field_48215_c) {
      theVillager.getNavigator().func_48652_a(theGolem, 0.15F);
      field_48213_d = true;
    }

    if (field_48213_d && theVillager.getDistanceSqToEntity(theGolem) < 4D) {
      theGolem.func_48383_a(false);
      theVillager.getNavigator().clearPathEntity();
    }
  }
Exemplo 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);
    }
  }
Exemplo 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;
  }