コード例 #1
0
  @Override
  protected void freeChunk(Point p) {
    int x = (int) p.getX() >> Chunk.BLOCKS.BITS;
    int y = (int) p.getY() >> Chunk.BLOCKS.BITS; // + SEALEVEL_CHUNK;
    int z = (int) p.getZ() >> Chunk.BLOCKS.BITS;

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

    TIntSet column = initializedChunks.get(x, z);
    CompressedChunkMessage CCMsg;
    if (column != null) {
      column.remove(y);
      if (column.isEmpty()) {
        if (initializedChunks.remove(x, z) != null) {
          activeChunks.remove(x, z);
        }
        CCMsg = new CompressedChunkMessage(x, z, true, null, null, null, true);
      } else {
        CCMsg = new CompressedChunkMessage(x, z, false, null, null, null, true);
      }

      session.send(false, CCMsg);
    }
  }
コード例 #2
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);
  }
コード例 #3
0
  @Override
  public void preSnapshot() {
    super.preSnapshot();

    Long key;
    while ((key = this.emptyColumns.poll()) != null) {
      int x = IntPairHashed.key1(key);
      int z = IntPairHashed.key2(key);
      TIntSet column = initializedChunks.get(x, z);
      if (column.isEmpty()) {
        column = initializedChunks.remove(x, z);
        activeChunks.remove(x, z);
        session.send(
            false, new ChunkDataMessage(x, z, true, null, null, null, true, player.getSession()));
      }
    }
  }
コード例 #4
0
ファイル: SpoutWorld.java プロジェクト: nightslashs/Spout
  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;
  }
コード例 #5
0
  @Override
  protected void freeChunk(Point p) {
    int x = (int) p.getX() >> Chunk.BLOCKS.BITS;
    int y = (int) p.getY() >> Chunk.BLOCKS.BITS; // + SEALEVEL_CHUNK;
    int z = (int) p.getZ() >> Chunk.BLOCKS.BITS;

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

    TIntSet column = initializedChunks.get(x, z);
    if (column != null) {
      column.remove(y);
      if (column.isEmpty()) {
        emptyColumns.add(IntPairHashed.key(x, z));
      } // TODO - is this required?
      /*
      else {
      	CCMsg = new ChunkDataMessage(x, z, false, null, null, null, true);
      }*/
    }
  }
コード例 #6
0
  @Override
  protected void freeChunk(Point p) {
    int x = (int) p.getX() >> Chunk.BLOCKS.BITS;
    int y = (int) p.getY() >> Chunk.BLOCKS.BITS; // + SEALEVEL_CHUNK;
    int z = (int) p.getZ() >> Chunk.BLOCKS.BITS;

    RepositionManager rm = getRepositionManager();

    int cY = rm.convertChunkY(y);

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

    TIntSet column = initializedChunks.get(x, z);
    if (column != null) {
      column.remove(y);
      if (column.isEmpty()) {
        emptyColumns.add(IntPairHashed.key(x, z));
      }
    }
  }
コード例 #7
0
  @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);
  }