Added height modifier to height shader as well as difference between deep oceans and normal oceans.

This commit is contained in:
Harrison Deng 2020-05-03 12:16:37 -05:00
parent 1db4811d66
commit dc3ccb6ff0
2 changed files with 17 additions and 12 deletions

View File

@ -27,37 +27,40 @@ public class WorldHeightShader {
int height = 0;
String biomeName = biomeSet[0].name().toLowerCase();
if (!mapper.isLand(worldX, worldZ)) {
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.8d, 1.5d, 0.5d, 1d, 0.15d);
} else if (biomeName.contains("shore") || biomeName.contains("beach")) {
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1]));
if (biomeName.contains("deep")) {
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.9d, 1.5d, 0.5d, 1d, 0.125d);
} else {
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0]) + 1;
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.7d, 1.5d, 0.5d, 1d, 0.15d);
}
} else if (biomeName.contains("shore") || biomeName.contains("beach")) {
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 5d));
} else {
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0], 0d) + 1;
}
if (biomeName.contains("snowy")) height++;
if (height > worldHeight) throw new IllegalStateException("Resulting height is greater than world height! Biome this occurred on: " + biomeName);
height = Math.max(minimumHeight, 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;
String biomeName = biome.name().toLowerCase();
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")) {
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")) {
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")) {
res = (int) calculateTerrainFactor(worldX, worldZ, 80d);
res = (int) calculateTerrainFactor(worldX, worldZ, 80d + heightModifier);
} else if (biomeName.contains("shattered")) {
res = (int) calculateTerrainFactor(worldX, worldZ, 90d);
res = (int) calculateTerrainFactor(worldX, worldZ, 90d + heightModifier);
} else if (biomeName.contains("tall")) {
res = (int) calculateTerrainFactor(worldX, worldZ, 80d);
res = (int) calculateTerrainFactor(worldX, worldZ, 80d + heightModifier);
} else {
res = (int) calculateTerrainFactor(worldX, worldZ, 35d);
res = (int) calculateTerrainFactor(worldX, worldZ, 35d + heightModifier);
}
return res;
}

View File

@ -91,6 +91,8 @@ public class WorldLayerShader {
String biomeName = biome.toString().toLowerCase();
if (biomeName.contains("beach") || biomeName.contains("desert") || biomeName.contains("warm_ocean")) {
return Material.SAND;
} else if (biome == Biome.ICE_SPIKES) {
return Material.SNOW_BLOCK;
} else if (biomeName.contains("ocean")) {
return Material.GRAVEL;
} else if (biomeName.contains("stone")) {