From 10022876d55ae2db3ae20973ce2b1d04eceef883 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 4 May 2020 20:35:44 -0500 Subject: [PATCH] Fixed potential biome continuity logic mistake. --- .../world/TemperatureMap.java | 2 +- .../generation/biomes/UniqueBiomeGenerator.java | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/world/TemperatureMap.java b/src/main/java/ca/recrown/islandsurvivalcraft/world/TemperatureMap.java index 95f93e9..f63a67b 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/world/TemperatureMap.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/world/TemperatureMap.java @@ -17,7 +17,7 @@ public class TemperatureMap { public TemperatureMap(Random random) { temperatureCache = new Cache<>(1024); noiseGenerator = new SimplexOctaveGenerator(random, 2); - noiseGenerator.setScale(0.003D); + noiseGenerator.setScale(0.002D); } public float getTemperature(int worldX, int worldZ) { diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/world/generation/biomes/UniqueBiomeGenerator.java b/src/main/java/ca/recrown/islandsurvivalcraft/world/generation/biomes/UniqueBiomeGenerator.java index bc06b27..2c95037 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/world/generation/biomes/UniqueBiomeGenerator.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/world/generation/biomes/UniqueBiomeGenerator.java @@ -16,7 +16,7 @@ import ca.recrown.islandsurvivalcraft.world.TemperatureMap; public class UniqueBiomeGenerator implements BiomeGenerator { @Override - public void generateBiomeColumn(Biome[][][] chunkBiomeSets, World world, int chunkX, int chunkZ, int localX, int localZ, IslandWorldMap mapper, BiomeMap biomeSelector, TemperatureMap tempGen, Cache biomeCache, Cache chunkGenCache) { + public void generateBiomeColumn(Biome[][][] chunkBiomeSets, World world, int chunkX, int chunkZ, int localX, int localZ, IslandWorldMap islandMap, BiomeMap biomeSelector, TemperatureMap tempGen, Cache biomeCache, Cache chunkGenCache) { int worldX = 16 * chunkX + localX; int worldZ = 16 * chunkZ + localZ; Point2 chunkCoords = GeneralUtilities.worldToChunkCoordinates(new Point2(worldX, worldZ)); @@ -30,27 +30,27 @@ public class UniqueBiomeGenerator implements BiomeGenerator { } //Fine, check if it's ocean. - if (!mapper.isIsland(worldX, worldZ)) { + if (!islandMap.isIsland(worldX, worldZ)) { biomeSet = chunkBiomeSets[localX][localZ]; - biomeSet[0] = biomeSelector.getOceanBiome(tempGen.getTemperature(worldX, worldZ), mapper.isDeepOcean(worldX, worldZ), worldX, worldZ); + biomeSet[0] = biomeSelector.getOceanBiome(tempGen.getTemperature(worldX, worldZ), islandMap.isDeepOcean(worldX, worldZ), worldX, worldZ); setCacheBiome(worldX, worldZ, biomeSet, chunkBiomeSets, biomeCache); return; } //Shoot, looks like it's actually an island. DepthFirstSearch search = new DepthFirstSearch(); - search.setValidatable(mapper); + search.setValidatable(islandMap); - IslandInfo islandInfo = new IslandInfo(mapper, world, biomeCache, chunkGenCache); + IslandInfo islandInfo = new IslandInfo(islandMap, world, biomeCache, chunkGenCache); search.setStartPosition(worldX, worldZ); if (!search.findTarget(islandInfo)) { float temp = tempGen.getTemperature(worldX, worldZ); if (islandInfo.main == null) islandInfo.main = biomeSelector.getLandBiome(temp, worldX, worldZ); if (islandInfo.shore == null) islandInfo.shore = biomeSelector.getShoreBiome(islandInfo.main, temp); - if (islandInfo.shallow == null) islandInfo.shallow = biomeSelector.getOceanBiome(temp, mapper.isDeepOcean(worldX, worldZ), worldX, worldZ); + if (islandInfo.shallow == null) islandInfo.shallow = biomeSelector.getOceanBiome(temp, islandMap.isDeepOcean(worldX, worldZ), worldX, worldZ); } - PropagatorInfo propInfo = new PropagatorInfo(islandInfo, chunkBiomeSets, new Point2(chunkX, chunkZ), mapper, biomeCache); + PropagatorInfo propInfo = new PropagatorInfo(islandInfo, chunkBiomeSets, new Point2(chunkX, chunkZ), islandMap, biomeCache); Flooder flooder = new Flooder(new Point2(worldX, worldZ), propInfo); flooder.start(); } @@ -115,7 +115,7 @@ public class UniqueBiomeGenerator implements BiomeGenerator { if ((main == null || shore == null) && mapper.isLand(x, y)) { if (shore == null && mapper.isShore(x, y)) { main = biomeSet[0]; - } else { + } else if (main == null && !mapper.isShore(x, y)) { shore = biomeSet[0]; } } else if (shallow == null) {