Refactoring.

This commit is contained in:
Harrison Deng 2020-04-21 11:40:23 -05:00
parent 67a93fff5b
commit 35e52ae61b
4 changed files with 12 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import ca.recrown.islandsurvivalcraft.pathfinding.CoordinateTargetValidatable;
import ca.recrown.islandsurvivalcraft.pathfinding.DepthFirstSearch;
public class BiomePerIslandGenerator implements IslandBiomeGenerator, CoordinateTargetValidatable {
private IslandMapGenerator islandMapGenerator;
private IslandLocationGenerator islandLocator;
private BiomeSelector biomeSelector;
private TemperatureMapGenerator temperatureMapGenerator;
private int buildHeight;
@ -20,12 +20,12 @@ public class BiomePerIslandGenerator implements IslandBiomeGenerator, Coordinate
public BiomePerIslandGenerator() {
this.temperatureMapGenerator = new TemperatureMapGenerator();
dfs = new DepthFirstSearch(islandMapGenerator);
dfs = new DepthFirstSearch(islandLocator);
}
@Override
public void initialize(IslandMapGenerator mapGenerator, BiomeSelector biomeSelector) {
this.islandMapGenerator = mapGenerator;
public void initialize(IslandLocationGenerator mapGenerator, BiomeSelector biomeSelector) {
this.islandLocator = mapGenerator;
this.biomeSelector = biomeSelector;
}
@ -41,7 +41,7 @@ public class BiomePerIslandGenerator implements IslandBiomeGenerator, Coordinate
public boolean isCoordinateTarget(int x, int y) {
if (world.isChunkGenerated(x/16, y/16)) {
Biome foundBiome = world.getBiome(x, 0, y);
if (islandMapGenerator.isShore(x, y)) {
if (islandLocator.isShore(x, y)) {
shoreBiome = foundBiome;
} else {
mainBiome = foundBiome;
@ -58,7 +58,7 @@ public class BiomePerIslandGenerator implements IslandBiomeGenerator, Coordinate
int worldX = chunkX * 16 + localX;
int worldZ = chunkZ * 16 + localZ;
if (islandMapGenerator.isIsland(worldX, worldZ)) {
if (islandLocator.isIsland(worldX, worldZ)) {
if (mainBiome == null && shoreBiome == null) {
if (!dfs.findTarget(this)) {
temperature = temperatureMapGenerator.getTemperature(worldX, worldZ);
@ -75,7 +75,7 @@ public class BiomePerIslandGenerator implements IslandBiomeGenerator, Coordinate
Biome designatedBiome = mainBiome;
if (mainBiome == null) {
designatedBiome = Biome.OCEAN;
} else if (islandMapGenerator.isShore(worldX, worldZ)) {
} else if (islandLocator.isShore(worldX, worldZ)) {
designatedBiome = shoreBiome;
}

View File

@ -4,7 +4,7 @@ import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
public interface IslandBiomeGenerator {
public void initialize(IslandMapGenerator mapGenerator, BiomeSelector biome);
public void initialize(IslandLocationGenerator mapGenerator, BiomeSelector biome);
public void setWorld(World world);
public void GenerateBiome(int chunkX, int chunkZ, int localX, int localZ, BiomeGrid biome);
}

View File

@ -7,7 +7,7 @@ import org.bukkit.util.noise.SimplexOctaveGenerator;
import ca.recrown.islandsurvivalcraft.pathfinding.CoordinateValidatable;
import ca.recrown.islandsurvivalcraft.pathfinding.DepthFirstSearch;
public class IslandMapGenerator implements CoordinateValidatable {
public class IslandLocationGenerator implements CoordinateValidatable {
private Random random;
private SimplexOctaveGenerator noiseGenerator;
private final int noiseOctaves = 8;
@ -22,7 +22,7 @@ public class IslandMapGenerator implements CoordinateValidatable {
private int shallowDepth;
private final DepthFirstSearch dfs;
public IslandMapGenerator() {
public IslandLocationGenerator() {
dfs = new DepthFirstSearch(this);
}

View File

@ -10,12 +10,12 @@ public class IslandSurvivalCraftWorldGenerator extends ChunkGenerator {
private final BedrockGenerator bedrockGenerator;
private final BiomeSelector biomeSelector;
private final IslandBiomeGenerator biomeGenerator;
private final IslandMapGenerator islandMapGenerator;
private final IslandLocationGenerator islandMapGenerator;
public IslandSurvivalCraftWorldGenerator(IslandBiomeGenerator generator) {
this.biomeSelector = new BiomeSelector();
this.bedrockGenerator = new BedrockGenerator();
this.islandMapGenerator = new IslandMapGenerator();
this.islandMapGenerator = new IslandLocationGenerator();
this.biomeGenerator = generator;
}