Skip to content

Commit

Permalink
World initializing doesn't load all regions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Fedin committed Nov 25, 2016
1 parent c01c9c5 commit 3b4527a
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/main/java/ru/wpstuio/amorphine/mcaliases/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
*/
public class World {

private File world_dir;
private final File world_dir;

private RegionFile[][] region_files = new RegionFile[32][32];

private ConcurrentMap<Coordinates2d, Region> regions = new ConcurrentLinkedHashMap.Builder<Coordinates2d, Region>()
.maximumWeightedCapacity(2)
.maximumWeightedCapacity(10)
.build();

public World(File world_dir) throws IOException {
Expand All @@ -46,31 +46,27 @@ public World(File world_dir) throws IOException {

int x = Integer.parseInt(splitted_file_name[1]);
int z =Integer.parseInt(splitted_file_name[2]);
Coordinates2d cords = new Coordinates2d(x, z);
region_files[x][z] = region_file;

Region region = new Region(region_file);

regions.putIfAbsent(cords, region);

region_files[x][z] = region_file;
}
}
}

/*

public Region getRegion(int x, int z) {

int[] coords = {x, z};
Coordinates2d cords = new Coordinates2d(x, z);

if(regions.containsKey(coords)) {
return regions.get(coords);
if(regions.containsKey(cords)) {
return regions.get(cords);
} else {
RegionFile region_file = region_files.get(coords);
RegionFile region_file = region_files[x][z];

Region region = new Region(region_file);
regions.put(coords, region);
regions.put(cords, region);

return region;
}
}
*/

}

0 comments on commit 3b4527a

Please sign in to comment.