Fixed potential biome continuity logic mistake.

This commit is contained in:
Harrison Deng 2020-05-04 20:35:44 -05:00
parent 785f7a1ea3
commit 10022876d5
2 changed files with 9 additions and 9 deletions

View File

@ -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) {

View File

@ -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<Point2, Biome[]> biomeCache, Cache<Point2, Boolean> chunkGenCache) {
public void generateBiomeColumn(Biome[][][] chunkBiomeSets, World world, int chunkX, int chunkZ, int localX, int localZ, IslandWorldMap islandMap, BiomeMap biomeSelector, TemperatureMap tempGen, Cache<Point2, Biome[]> biomeCache, Cache<Point2, Boolean> 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) {