From dc3ccb6ff0abad8f1c78cd89fbf99067509e8f93 Mon Sep 17 00:00:00 2001 From: Harrison Date: Sun, 3 May 2020 12:16:37 -0500 Subject: [PATCH] Added height modifier to height shader as well as difference between deep oceans and normal oceans. --- .../world/shaders/WorldHeightShader.java | 27 ++++++++++--------- .../world/shaders/WorldLayerShader.java | 2 ++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldHeightShader.java b/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldHeightShader.java index 6f713b9..180fd4e 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldHeightShader.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldHeightShader.java @@ -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); + 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")) { - height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1])); + height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 5d)); } else { - height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0]) + 1; + 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; } diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldLayerShader.java b/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldLayerShader.java index 6b1635a..b4c0518 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldLayerShader.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/world/shaders/WorldLayerShader.java @@ -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")) {