(Re)added shorelines and fixed both deep and transitional ocean generation.
This commit is contained in:
parent
3ab1e05569
commit
d8c0961e2b
@ -16,7 +16,7 @@ public class LandBiomeInfo implements Weightable, BiomeInfo {
|
|||||||
* @param biome the main biome this object represents.
|
* @param biome the main biome this object represents.
|
||||||
* @param transitionBiome the transition biome to go with this biome. May be null.
|
* @param transitionBiome the transition biome to go with this biome. May be null.
|
||||||
* @param hill the hill biome that goes with this biome. May be null.
|
* @param hill the hill biome that goes with this biome. May be null.
|
||||||
* @param shore the preferred shore that goes with this biome. May be null.
|
* @param shore the shore that goes with this biome. May be null.
|
||||||
* @param weight the weight, relative to the others, chance this biome spawns.
|
* @param weight the weight, relative to the others, chance this biome spawns.
|
||||||
*/
|
*/
|
||||||
public LandBiomeInfo(Biome biome, Biome transitionBiome, Biome hill, Biome shore, float weight) {
|
public LandBiomeInfo(Biome biome, Biome transitionBiome, Biome hill, Biome shore, float weight) {
|
||||||
@ -28,6 +28,13 @@ public class LandBiomeInfo implements Weightable, BiomeInfo {
|
|||||||
this.transitionBiome = transitionBiome;
|
this.transitionBiome = transitionBiome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a land biome information object.
|
||||||
|
* Leaves the transition biome and hill biomes as null.
|
||||||
|
* The shore is set to beach.
|
||||||
|
* @param biome The biome this object represents.
|
||||||
|
* @param weight The probability of selecting this biome.
|
||||||
|
*/
|
||||||
public LandBiomeInfo(Biome biome, float weight) {
|
public LandBiomeInfo(Biome biome, float weight) {
|
||||||
this(biome, null, null, Biome.BEACH, weight);
|
this(biome, null, null, Biome.BEACH, weight);
|
||||||
}
|
}
|
||||||
@ -39,26 +46,20 @@ public class LandBiomeInfo implements Weightable, BiomeInfo {
|
|||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the biome
|
|
||||||
*/
|
|
||||||
public Biome getBiome() {
|
|
||||||
return biome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the hill biome. Will return the normal biome if there is no special hill biome for this biome.
|
* @return the hill biome. Will return the normal biome if there is no special hill biome for this biome.
|
||||||
*/
|
*/
|
||||||
public Biome getHillBiome() {
|
public Biome getHillBiome() {
|
||||||
if (hillBiome == null) return getBiome();
|
if (hillBiome == null) return getMainBiome();
|
||||||
return hillBiome;
|
return hillBiome;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the shore biome. Should not have shore if null is returned.
|
* @return the shore biome. Will return the normal biome if there is no shore specificied.
|
||||||
*/
|
*/
|
||||||
public Biome getPreferredShore() {
|
public Biome getShoreBiome() {
|
||||||
return preferredShore;
|
if (preferredShore != null) return preferredShore;
|
||||||
|
return getMainBiome();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@ public class IslandWorldMap {
|
|||||||
private final float ISLAND_PERCENT = 0.36f;
|
private final float ISLAND_PERCENT = 0.36f;
|
||||||
private final double NOISE_FREQ = 1.78D;
|
private final double NOISE_FREQ = 1.78D;
|
||||||
private final double NOISE_AMP = 0.47D;
|
private final double NOISE_AMP = 0.47D;
|
||||||
private final float SHORE_PORTION = 0.095f;
|
|
||||||
private final float SHALLOW_PORTION = 0.06f;
|
private final float SHALLOW_PORTION = 0.06f;
|
||||||
private final double SCALE = 0.005D;
|
private final double SCALE = 0.005D;
|
||||||
private final DepthFirstSearch dfs;
|
private final DepthFirstSearch dfs;
|
||||||
@ -64,22 +63,6 @@ public class IslandWorldMap {
|
|||||||
isSameIsland(worldX, worldZ, worldX, worldZ - 1));
|
isSameIsland(worldX, worldZ, worldX, worldZ - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* These coordinates are considered to be the shore if:
|
|
||||||
* It is a part of an island,
|
|
||||||
* the island value is less than the shore factor.
|
|
||||||
* @param worldX the X coordinate of location in world.
|
|
||||||
* @param worldZ the Z coordinate of location in world.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isShore(int worldX, int worldZ) {
|
|
||||||
if (!isIsland(worldX, worldZ)) return false;
|
|
||||||
if (isLand(worldX, worldZ) && getWorldValue(worldX, worldZ) <= SHORE_PORTION) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Considers these coordinates to be part of an island if:
|
* Considers these coordinates to be part of an island if:
|
||||||
* It is land, or if it is a shallow portion of land.
|
* It is land, or if it is a shallow portion of land.
|
||||||
|
@ -33,6 +33,7 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
private final float TRANSITION_DEPTH_PORTION = 0.1f;
|
private final float TRANSITION_DEPTH_PORTION = 0.1f;
|
||||||
private final float DEEP_OCEAN_PORTION = 0.5f;
|
private final float DEEP_OCEAN_PORTION = 0.5f;
|
||||||
private final float HILL_BIOME_PORTION = 0.4f;
|
private final float HILL_BIOME_PORTION = 0.4f;
|
||||||
|
private final float SHORE_PORTION = 0.095f;
|
||||||
private final int BEDROCK_HEIGHT = 5;
|
private final int BEDROCK_HEIGHT = 5;
|
||||||
private volatile GeneratorModes generatorType;
|
private volatile GeneratorModes generatorType;
|
||||||
private volatile boolean initialized = false;
|
private volatile boolean initialized = false;
|
||||||
@ -110,35 +111,27 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
double islandVal = islandMap.getWorldValue(worldX, worldZ);
|
double islandVal = islandMap.getWorldValue(worldX, worldZ);
|
||||||
if (islandVal >= HILL_BIOME_PORTION) {
|
if (islandVal >= HILL_BIOME_PORTION) {
|
||||||
currentBiome = biomeInfo.getHillBiome();
|
currentBiome = biomeInfo.getHillBiome();
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeInfo.getHillBiome());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
currentBiome = biomeInfo.getBiome();
|
if (islandVal <= SHORE_PORTION) {
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
currentBiome = biomeInfo.getShoreBiome();
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeInfo.getBiome());
|
} else {
|
||||||
|
currentBiome = biomeInfo.getMainBiome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OceanBiomeInfo biomeInfo = (OceanBiomeInfo) localBiomeInfos[localX][localZ];
|
OceanBiomeInfo biomeInfo = (OceanBiomeInfo) localBiomeInfos[localX][localZ];
|
||||||
double oceanVal = islandMap.getWorldValue(worldX, worldZ);
|
double oceanVal = islandMap.getWorldValue(worldX, worldZ);
|
||||||
if (oceanVal >= TRANSITION_DEPTH_PORTION) {
|
if (oceanVal >= -TRANSITION_DEPTH_PORTION) {
|
||||||
currentBiome = biomeInfo.getTransitionOcean();
|
currentBiome = biomeInfo.getTransitionOcean();
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
} else if (oceanVal >= -DEEP_OCEAN_PORTION) {
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeInfo.getTransitionOcean());
|
|
||||||
}
|
|
||||||
} else if (oceanVal >= DEEP_OCEAN_PORTION) {
|
|
||||||
currentBiome = biomeInfo.getOcean();
|
currentBiome = biomeInfo.getOcean();
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeInfo.getOcean());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
currentBiome = biomeInfo.getDeepAlternative();
|
currentBiome = biomeInfo.getDeepAlternative();
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeInfo.getDeepAlternative());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
||||||
|
biomeGrid.setBiome(localX, y, localZ, currentBiome);
|
||||||
|
}
|
||||||
|
|
||||||
BiomeInfo currentBiomeInfo = localBiomeInfos[localX][localZ];
|
BiomeInfo currentBiomeInfo = localBiomeInfos[localX][localZ];
|
||||||
int terrainHeight = heightShader.getTerrainHeight(worldX, worldZ, currentBiomeInfo);
|
int terrainHeight = heightShader.getTerrainHeight(worldX, worldZ, currentBiomeInfo);
|
||||||
@ -199,7 +192,7 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldGenerateStructures() {
|
public boolean shouldGenerateStructures() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user