Fixed potential biome continuity logic mistake.
This commit is contained in:
parent
785f7a1ea3
commit
10022876d5
@ -17,7 +17,7 @@ public class TemperatureMap {
|
|||||||
public TemperatureMap(Random random) {
|
public TemperatureMap(Random random) {
|
||||||
temperatureCache = new Cache<>(1024);
|
temperatureCache = new Cache<>(1024);
|
||||||
noiseGenerator = new SimplexOctaveGenerator(random, 2);
|
noiseGenerator = new SimplexOctaveGenerator(random, 2);
|
||||||
noiseGenerator.setScale(0.003D);
|
noiseGenerator.setScale(0.002D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTemperature(int worldX, int worldZ) {
|
public float getTemperature(int worldX, int worldZ) {
|
||||||
|
@ -16,7 +16,7 @@ import ca.recrown.islandsurvivalcraft.world.TemperatureMap;
|
|||||||
|
|
||||||
public class UniqueBiomeGenerator implements BiomeGenerator {
|
public class UniqueBiomeGenerator implements BiomeGenerator {
|
||||||
@Override
|
@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 worldX = 16 * chunkX + localX;
|
||||||
int worldZ = 16 * chunkZ + localZ;
|
int worldZ = 16 * chunkZ + localZ;
|
||||||
Point2 chunkCoords = GeneralUtilities.worldToChunkCoordinates(new Point2(worldX, worldZ));
|
Point2 chunkCoords = GeneralUtilities.worldToChunkCoordinates(new Point2(worldX, worldZ));
|
||||||
@ -30,27 +30,27 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Fine, check if it's ocean.
|
//Fine, check if it's ocean.
|
||||||
if (!mapper.isIsland(worldX, worldZ)) {
|
if (!islandMap.isIsland(worldX, worldZ)) {
|
||||||
biomeSet = chunkBiomeSets[localX][localZ];
|
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);
|
setCacheBiome(worldX, worldZ, biomeSet, chunkBiomeSets, biomeCache);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Shoot, looks like it's actually an island.
|
//Shoot, looks like it's actually an island.
|
||||||
DepthFirstSearch search = new DepthFirstSearch();
|
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);
|
search.setStartPosition(worldX, worldZ);
|
||||||
if (!search.findTarget(islandInfo)) {
|
if (!search.findTarget(islandInfo)) {
|
||||||
float temp = tempGen.getTemperature(worldX, worldZ);
|
float temp = tempGen.getTemperature(worldX, worldZ);
|
||||||
if (islandInfo.main == null) islandInfo.main = biomeSelector.getLandBiome(temp, 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.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 flooder = new Flooder(new Point2(worldX, worldZ), propInfo);
|
||||||
flooder.start();
|
flooder.start();
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
if ((main == null || shore == null) && mapper.isLand(x, y)) {
|
if ((main == null || shore == null) && mapper.isLand(x, y)) {
|
||||||
if (shore == null && mapper.isShore(x, y)) {
|
if (shore == null && mapper.isShore(x, y)) {
|
||||||
main = biomeSet[0];
|
main = biomeSet[0];
|
||||||
} else {
|
} else if (main == null && !mapper.isShore(x, y)) {
|
||||||
shore = biomeSet[0];
|
shore = biomeSet[0];
|
||||||
}
|
}
|
||||||
} else if (shallow == null) {
|
} else if (shallow == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user