Exemplo n.º 1
0
 @Override
 public ChunkViewCore getLocalView(Vector3i centerChunkPos) {
   Region3i region =
       Region3i.createFromCenterExtents(centerChunkPos, ChunkConstants.LOCAL_REGION_EXTENTS);
   if (getChunk(centerChunkPos) != null) {
     return createWorldView(region, Vector3i.one());
   }
   return null;
 }
Exemplo n.º 2
0
 @Override
 public ChunkViewCore getSubviewAroundChunk(Vector3i chunkPos) {
   Region3i region =
       Region3i.createFromCenterExtents(chunkPos, ChunkConstants.LOCAL_REGION_EXTENTS);
   if (getChunk(chunkPos) != null) {
     return createWorldView(
         region, new Vector3i(-region.min().x, -region.min().y, -region.min().z));
   }
   return null;
 }
Exemplo n.º 3
0
 private boolean makeChunkAvailable(final ReadyChunkInfo readyChunkInfo) {
   final Chunk chunk = nearCache.get(readyChunkInfo.getPos());
   if (chunk == null) {
     return false;
   }
   for (Vector3i pos : Region3i.createFromCenterExtents(readyChunkInfo.getPos(), 1)) {
     if (nearCache.get(pos) == null) {
       return false;
     }
   }
   lightMerger.beginMerge(chunk, readyChunkInfo);
   return true;
 }
Exemplo n.º 4
0
  @Test
  public void borderCalculation() {
    WorldBuilder worldBuilder = new WorldBuilder(12L);
    worldBuilder.addProvider(new Facet1Provider());
    worldBuilder.addProvider(new Facet2Provider());

    World world = worldBuilder.build();
    Region3i regionToGenerate = Region3i.createFromCenterExtents(new Vector3i(), 1);
    Region regionData = world.getWorldData(regionToGenerate);

    Facet1 facet1 = regionData.getFacet(Facet1.class);
    assertEquals(regionToGenerate, facet1.getWorldRegion());

    Facet2 facet2 = regionData.getFacet(Facet2.class);
    assertEquals(
        Region3i.createFromMinAndSize(new Vector3i(-3, -1, -3), new Vector3i(7, 3, 7)),
        facet2.getWorldRegion());
  }