From 35e52ae61b8312fcab8a1c31080d624100ce0309 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 21 Apr 2020 11:40:23 -0500 Subject: [PATCH] Refactoring. --- .../worldgeneration/BiomePerIslandGenerator.java | 14 +++++++------- .../worldgeneration/IslandBiomeGenerator.java | 2 +- ...Generator.java => IslandLocationGenerator.java} | 4 ++-- .../IslandSurvivalCraftWorldGenerator.java | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) rename src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/{IslandMapGenerator.java => IslandLocationGenerator.java} (98%) diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/BiomePerIslandGenerator.java b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/BiomePerIslandGenerator.java index 3a86e5c..a3c2404 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/BiomePerIslandGenerator.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/BiomePerIslandGenerator.java @@ -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; } diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandBiomeGenerator.java b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandBiomeGenerator.java index c660afa..5007375 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandBiomeGenerator.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandBiomeGenerator.java @@ -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); } diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandMapGenerator.java b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandLocationGenerator.java similarity index 98% rename from src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandMapGenerator.java rename to src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandLocationGenerator.java index a099007..4c05422 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandMapGenerator.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandLocationGenerator.java @@ -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); } diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandSurvivalCraftWorldGenerator.java b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandSurvivalCraftWorldGenerator.java index 9ffa7eb..26aee4f 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandSurvivalCraftWorldGenerator.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/worldgeneration/IslandSurvivalCraftWorldGenerator.java @@ -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; }