Exemplo n.º 1
0
  protected SpoutColumn getColumn(int x, int z, LoadOption loadopt, boolean sync) {

    long key = IntPairHashed.key(x, z);
    SpoutColumn column = columns.get(key);
    if (column != null || !loadopt.loadIfNeeded()) {
      return column;
    }

    column = loadColumn(x, z);
    if (column != null || !loadopt.generateIfNeeded()) {
      return column;
    }

    int[][] height = this.getGenerator().getSurfaceHeight(this, x, z);

    int h = (height[7][7] >> Chunk.BLOCKS.BITS);

    SpoutRegion r = getRegionFromChunk(x, h, z, loadopt);

    if (r == null) {
      throw new IllegalStateException(
          "Unable to generate region for new column and load option " + loadopt);
    }

    r.getRegionGenerator().generateColumn(x, z, sync, true);

    column = getColumn(x, z, LoadOption.LOAD_ONLY);

    if (column == null) {
      throw new IllegalStateException("Unable to generate column " + x + ", " + z);
    }

    return column;
  }