Exemplo n.º 1
0
 /**
  * Creates a set of regions from a region id. This is useful in the case where the region is
  * compound (e.g. NY+LON).
  *
  * @param regionSource The region source, not null
  * @param regionId The region id, not null
  * @return a set of the region(s)
  */
 public static Set<Region> getRegions(RegionSource regionSource, final ExternalId regionId) {
   Validate.notNull(regionSource, "region source");
   Validate.notNull(regionId, "region id");
   if (regionId.isScheme(RegionUtils.FINANCIAL) && regionId.getValue().contains("+")) {
     final String[] regions = regionId.getValue().split("\\+");
     final Set<Region> resultRegions = new HashSet<Region>();
     for (final String region : regions) {
       resultRegions.add(
           regionSource.getHighestLevelRegion(RegionUtils.financialRegionId(region)));
     }
     return resultRegions;
   }
   return Collections.singleton(regionSource.getHighestLevelRegion(regionId));
 }
Exemplo n.º 2
0
 @Override
 public Region getRegion(Point point, boolean load) {
   int x = MathHelper.floor(point.getX());
   int y = MathHelper.floor(point.getY());
   int z = MathHelper.floor(point.getZ());
   return regions.getRegionFromBlock(x, y, z, load);
 }
Exemplo n.º 3
0
  // TODO need world that loads from disk
  // TODO set up number of stages ?
  public SpoutWorld(String name, Server server, long seed, WorldGenerator generator) {
    super(1, new ThreadAsyncExecutor(), server);
    uid = UUID.randomUUID();
    this.server = server;
    this.seed = seed;
    this.name = name;
    this.generator = generator;
    entityManager = new EntityManager();
    regions = new RegionSource(this, snapshotManager);

    // load spawn regions
    for (int dx = -1; dx < 1; dx++) {
      for (int dy = -1; dy < 1; dy++) {
        for (int dz = -1; dz < 1; dz++) {
          regions.getRegion(dx, dy, dz, true, true);
        }
      }
    }
  }
Exemplo n.º 4
0
 @Override
 public SpoutRegion getRegion(int x, int y, int z, LoadOption loadopt) {
   return regions.getRegion(x, y, z, loadopt);
 }
Exemplo n.º 5
0
 @Override
 public void updatePhysics(int x, int y, int z) {
   regions.getRegionFromBlock(x, y, z).queuePhysicsUpdate(x, y, z);
 }
Exemplo n.º 6
0
 @Override
 public Region getRegionFromBlock(int x, int y, int z) {
   return regions.getRegionFromBlock(x, y, z);
 }
Exemplo n.º 7
0
 @Override
 public Region getRegion(int x, int y, int z, boolean load) {
   return regions.getRegion(x, y, z, load);
 }
Exemplo n.º 8
0
 @Override
 public Region getRegion(int x, int y, int z) {
   return regions.getRegion(x, y, z);
 }