Added height modifier to height shader as well as difference between deep oceans and normal oceans.
This commit is contained in:
parent
1db4811d66
commit
dc3ccb6ff0
@ -27,37 +27,40 @@ public class WorldHeightShader {
|
|||||||
int height = 0;
|
int height = 0;
|
||||||
String biomeName = biomeSet[0].name().toLowerCase();
|
String biomeName = biomeSet[0].name().toLowerCase();
|
||||||
if (!mapper.isLand(worldX, worldZ)) {
|
if (!mapper.isLand(worldX, worldZ)) {
|
||||||
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.8d, 1.5d, 0.5d, 1d, 0.15d);
|
if (biomeName.contains("deep")) {
|
||||||
|
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.9d, 1.5d, 0.5d, 1d, 0.125d);
|
||||||
|
} else {
|
||||||
|
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.7d, 1.5d, 0.5d, 1d, 0.15d);
|
||||||
|
}
|
||||||
} else if (biomeName.contains("shore") || biomeName.contains("beach")) {
|
} else if (biomeName.contains("shore") || biomeName.contains("beach")) {
|
||||||
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1]));
|
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 5d));
|
||||||
} else {
|
} else {
|
||||||
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0]) + 1;
|
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0], 0d) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (biomeName.contains("snowy")) height++;
|
if (biomeName.contains("snowy")) height++;
|
||||||
|
|
||||||
if (height > worldHeight) throw new IllegalStateException("Resulting height is greater than world height! Biome this occurred on: " + biomeName);
|
if (height > worldHeight) throw new IllegalStateException("Resulting height is greater than world height! Biome this occurred on: " + biomeName);
|
||||||
height = Math.max(minimumHeight, height);
|
height = Math.max(minimumHeight, height);
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getIslandBiomeHeight(int worldX, int worldZ, Biome biome) {
|
private int getIslandBiomeHeight(int worldX, int worldZ, Biome biome, double heightModifier) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
String biomeName = biome.name().toLowerCase();
|
String biomeName = biome.name().toLowerCase();
|
||||||
if (biomeName.contains("hills")) {
|
if (biomeName.contains("hills")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 60d, 1.5d, 0.5d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 60d + heightModifier, 1.5d, 0.5d);
|
||||||
} else if (biomeName.contains("mountains")) {
|
} else if (biomeName.contains("mountains")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 200d, 1.8d, 0.5d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 200d + heightModifier, 1.8d, 0.5d);
|
||||||
} else if (biomeName.contains("plateau")) {
|
} else if (biomeName.contains("plateau")) {
|
||||||
res = (int) Math.min(calculateTerrainFactor(worldX, worldZ, 60d), seaLevel + 30d);
|
res = (int) Math.min(calculateTerrainFactor(worldX, worldZ, 60d + heightModifier), seaLevel + 30d);
|
||||||
} else if (biomeName.contains("modified")) {
|
} else if (biomeName.contains("modified")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 80d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 80d + heightModifier);
|
||||||
} else if (biomeName.contains("shattered")) {
|
} else if (biomeName.contains("shattered")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 90d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 90d + heightModifier);
|
||||||
} else if (biomeName.contains("tall")) {
|
} else if (biomeName.contains("tall")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 80d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 80d + heightModifier);
|
||||||
} else {
|
} else {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 35d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 35d + heightModifier);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,8 @@ public class WorldLayerShader {
|
|||||||
String biomeName = biome.toString().toLowerCase();
|
String biomeName = biome.toString().toLowerCase();
|
||||||
if (biomeName.contains("beach") || biomeName.contains("desert") || biomeName.contains("warm_ocean")) {
|
if (biomeName.contains("beach") || biomeName.contains("desert") || biomeName.contains("warm_ocean")) {
|
||||||
return Material.SAND;
|
return Material.SAND;
|
||||||
|
} else if (biome == Biome.ICE_SPIKES) {
|
||||||
|
return Material.SNOW_BLOCK;
|
||||||
} else if (biomeName.contains("ocean")) {
|
} else if (biomeName.contains("ocean")) {
|
||||||
return Material.GRAVEL;
|
return Material.GRAVEL;
|
||||||
} else if (biomeName.contains("stone")) {
|
} else if (biomeName.contains("stone")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user