/** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (this.swimmingEntity.getRNG().nextFloat() < 0.50) {
      return false;
    }

    Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.swimmingEntity, 6, 2);

    if (vec3 == null) {
      return false;
    } else {
      this.xPosition = vec3.xCoord;
      this.yPosition = vec3.yCoord;
      this.zPosition = vec3.zCoord;
      return true;
    }
  }
Exemplo n.º 2
0
  /** Returns whether the EntityAIBase should begin execution. */
  public boolean shouldExecute() {
    if (this.entity.OrderStatus == null) {
      this.entity.OrderStatus = EnumOrderType.FreeMove;
    }

    if (this.entity.getRNG().nextInt(120) != 0) {
      return false;
    } else if (this.entity.isTamed() && this.entity.OrderStatus != EnumOrderType.FreeMove) {
      return false;
    } else {
      Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);

      if (vec3 == null) {
        return false;
      } else {
        this.xPosition = vec3.xCoord;
        this.yPosition = vec3.yCoord;
        this.zPosition = vec3.zCoord;
        return true;
      }
    }
  }