@Override
  public float generateNoise(
      PerlinNoise perlin, CellNoise cell, int x, int y, float ocean, float border, float river) {
    float st = (perlin.noise2(x / 160f, y / 160f) + 0.38f) * 35f * river;
    st = st < 0.2f ? 0.2f : st;

    float h = perlin.noise2(x / 60f, y / 60f) * st * 2f;
    h = h > 0f ? -h : h;
    h += st;
    h *= h / 50f;
    h += st;

    return 70f + h;
  }
  @Override
  public void paintTerrain(
      Block[] blocks,
      byte[] metadata,
      int i,
      int j,
      int x,
      int y,
      int depth,
      World world,
      Random rand,
      PerlinNoise perlin,
      CellNoise cell,
      float[] noise,
      float river,
      BiomeGenBase[] base) {
    float c = CliffCalculator.calc(x, y, noise);
    boolean cliff = c > 1.3f ? true : false;
    boolean dirt = false;

    for (int k = 255; k > -1; k--) {
      Block b = blocks[(y * 16 + x) * 256 + k];
      if (b == Blocks.air) {
        depth = -1;
      } else if (b == Blocks.stone) {
        depth++;

        if (cliff) {
          if (cliffType == 1) {
            if (depth < 6) {
              blocks[(y * 16 + x) * 256 + k] = cliffBlock1;
              metadata[(y * 16 + x) * 256 + k] = 14;
            }
          } else {
            if (depth > -1 && depth < 2) {
              blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1;
            } else if (depth < 10) {
              blocks[(y * 16 + x) * 256 + k] = cliffBlock1;
            }
          }
        } else if (depth < 6) {
          if (depth == 0 && k > 61) {
            if (perlin.noise2(i / 12f, j / 12f) > -0.3f + ((k - 61f) / 15f)) {
              dirt = true;
              blocks[(y * 16 + x) * 256 + k] = topBlock;
            } else {
              blocks[(y * 16 + x) * 256 + k] = Blocks.sand;
              metadata[(y * 16 + x) * 256 + k] = sandMetadata;
            }
          } else if (depth < 4) {
            if (dirt) {
              blocks[(y * 16 + x) * 256 + k] = fillerBlock;
            } else {
              blocks[(y * 16 + x) * 256 + k] = Blocks.sand;
              metadata[(y * 16 + x) * 256 + k] = sandMetadata;
            }
          } else if (!dirt) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.sandstone;
          }
        }
      }
    }
  }
  @Override
  public void paintTerrain(
      Block[] blocks,
      byte[] metadata,
      int i,
      int j,
      int x,
      int y,
      int depth,
      World world,
      Random rand,
      PerlinNoise perlin,
      CellNoise cell,
      float[] noise,
      float river,
      BiomeGenBase[] base) {
    float c = CliffCalculator.calc(x, y, noise);
    int cliff = 0;
    boolean gravel = false;

    Block b;
    for (int k = 255; k > -1; k--) {
      b = blocks[(y * 16 + x) * 256 + k];
      if (b == Blocks.air) {
        depth = -1;
      } else if (b == Blocks.stone) {
        depth++;

        if (depth == 0) {
          if (k < 63) {
            if (beach) {
              gravel = true;
            }
          }

          float p = perlin.noise3(i / 8f, j / 8f, k / 8f) * 0.5f;
          if (c > min && c > sCliff - ((k - sHeight) / sStrength) + p) {
            cliff = 1;
          }
          if (c > cCliff) {
            cliff = 2;
          }
          if (k > 110 + (p * 4) && c < iCliff + ((k - iHeight) / iStrength) + p) {
            cliff = 3;
          }

          if (cliff == 1) {
            blocks[(y * 16 + x) * 256 + k] =
                rand.nextInt(3) == 0 ? Blocks.cobblestone : Blocks.stone;
          } else if (cliff == 2) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay;
            metadata[(y * 16 + x) * 256 + k] = 9;
          } else if (cliff == 3) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.snow;
          } else if (k < 63) {
            if (beach) {
              blocks[(y * 16 + x) * 256 + k] = beachBlock;
              gravel = true;
            } else if (k < 62) {
              blocks[(y * 16 + x) * 256 + k] = fillerBlock;
            } else {
              blocks[(y * 16 + x) * 256 + k] = topBlock;
            }
          } else {
            blocks[(y * 16 + x) * 256 + k] = Blocks.grass;
          }
        } else if (depth < 6) {
          if (cliff == 1) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.stone;
          } else if (cliff == 2) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay;
            metadata[(y * 16 + x) * 256 + k] = 9;
          } else if (cliff == 3) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.snow;
          } else if (gravel) {
            blocks[(y * 16 + x) * 256 + k] = Blocks.gravel;
          } else {
            blocks[(y * 16 + x) * 256 + k] = Blocks.dirt;
          }
        }
      }
    }
  }