Ejemplo n.º 1
0
  private void initChunkRaw(Point p) {
    int x = p.getChunkX();
    int y = p.getChunkY(); // + SEALEVEL_CHUNK;
    int z = p.getChunkZ();

    RepositionManager rm = getRepositionManager();

    int cY = rm.convertChunkY(y);

    if (cY < 0 || cY >= p.getWorld().getHeight() >> Chunk.BLOCKS.BITS) {
      return;
    }

    TSyncIntHashSet column = initializedChunks.get(x, z);
    if (column == null) {
      column = new TSyncIntHashSet();
      synchronized (initChunkLock) {
        TSyncIntHashSet oldColumn = initializedChunks.putIfAbsent(x, z, column);
        if (oldColumn != null) {
          column = oldColumn;
        }
      }
    }
    column.add(y);
  }
Ejemplo n.º 2
0
  private BAAWrapper getColumnHeightMapBAA(int x, int z) {
    int cx = x >> Region.CHUNKS.BITS;
    int cz = z >> Region.CHUNKS.BITS;

    BAAWrapper baa = null;

    baa = heightMapBAAs.get(cx, cz);

    if (baa == null) {
      File columnDirectory = new File(worldDirectory, "col");
      columnDirectory.mkdirs();
      File file = new File(columnDirectory, "col" + cx + "_" + cz + ".sco");
      baa = new BAAWrapper(file, 1024, 256, RegionFileManager.TIMEOUT);
      BAAWrapper oldBAA = heightMapBAAs.putIfAbsent(cx, cz, baa);
      if (oldBAA != null) {
        baa = oldBAA;
      }
    }

    return baa;
  }
  @Override
  protected void initChunk(Point p) {

    int x = p.getChunkX();
    int y = p.getChunkY(); // + SEALEVEL_CHUNK;
    int z = p.getChunkZ();

    if (y < 0 || y >= p.getWorld().getHeight() >> Chunk.BLOCKS.BITS) {
      return;
    }

    TSyncIntHashSet column = initializedChunks.get(x, z);
    if (column == null) {
      column = new TSyncIntHashSet();
      synchronized (initChunkLock) {
        TSyncIntHashSet oldColumn = initializedChunks.putIfAbsent(x, z, column);
        if (oldColumn != null) {
          column = oldColumn;
        }
      }
    }
    column.add(y);
  }