diff options
author | makamys <makamys@outlook.com> | 2021-06-04 22:20:54 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2021-06-04 22:20:54 +0200 |
commit | 81696d7b3dfae030d10672d38eb5b28049733cd5 (patch) | |
tree | bfcf153f733d16217125a9071cd45c5184aec7f5 /src/main/java/makamys | |
parent | 7efc1268d83511653a015611faeb4a5ead0354be (diff) | |
download | Neodymium-81696d7b3dfae030d10672d38eb5b28049733cd5.tar.gz Neodymium-81696d7b3dfae030d10672d38eb5b28049733cd5.tar.bz2 Neodymium-81696d7b3dfae030d10672d38eb5b28049733cd5.zip |
Add option to force vanilla temperature algorithm, fixes SS incompatibility
Serene Seasons changes biomes to be colder in certain seasons, making
LODMod think there should be snow there, while no snow is actually
generated. Setting this config option to true fixes this mismatch.
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r-- | src/main/java/makamys/lodmod/LODMod.java | 3 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java | 4 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/util/MCUtil.java | 20 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index c700f77..1490a0a 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -51,6 +51,7 @@ public class LODMod public static double fogStart; public static double fogEnd; public static float maxSimpleMeshHeight; + public static boolean forceVanillaBiomeTemperature; private File configFile; @@ -83,6 +84,8 @@ public class LODMod fogEnd = config.get("Fog", "fogEnd", "0.8").getDouble(); debugEnabled = config.get("Debug", "enabled", false).getBoolean(); maxSimpleMeshHeight = (float)config.get("Debug", "maxSimpleMeshHeight", 1000.0).getDouble(); + + forceVanillaBiomeTemperature = config.get("Simple mesh generation", "forceVanillaBiomeTemperature", true).getBoolean(); if(config.hasChanged()) { config.save(); diff --git a/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java b/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java index 07bb084..4065b6c 100644 --- a/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java +++ b/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java @@ -17,6 +17,7 @@ import java.util.List; import org.lwjgl.BufferUtils; import makamys.lodmod.LODMod; +import makamys.lodmod.util.MCUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockLeaves; @@ -125,7 +126,8 @@ public class SimpleChunkMesh extends Mesh { } color = (0xFF << 24) | ((color >> 16 & 0xFF) << 0) | ((color >> 8 & 0xFF) << 8) | ((color >> 0 & 0xFF) << 16); - if(biome.getFloatTemperature(worldX, y, worldZ) < 0.15f) { + if((LODMod.forceVanillaBiomeTemperature ? MCUtil.getBiomeTemperatureVanilla(biome, worldX, y, worldZ) + : biome.getFloatTemperature(worldX, y, worldZ)) < 0.15f) { builder.addCube(divX, divZ, worldY + 0.2f, 1f, Blocks.snow_layer.getIcon(1, 0), 0xFFFFFFFF, brightnessMult); builder.addCube(divX, divZ, worldY - 0.8f, -1, icon, color, brightnessMult); diff --git a/src/main/java/makamys/lodmod/util/MCUtil.java b/src/main/java/makamys/lodmod/util/MCUtil.java new file mode 100644 index 0000000..7f81d74 --- /dev/null +++ b/src/main/java/makamys/lodmod/util/MCUtil.java @@ -0,0 +1,20 @@ +package makamys.lodmod.util; + +import net.minecraft.world.biome.BiomeGenBase; + +public class MCUtil { + + public static float getBiomeTemperatureVanilla(BiomeGenBase biome, int p_150564_1_, int p_150564_2_, int p_150564_3_){ + if (p_150564_2_ > 64) + { + float f = (float)BiomeGenBase.temperatureNoise + .func_151601_a((double)p_150564_1_ * 1.0D / 8.0D, (double)p_150564_3_ * 1.0D / 8.0D) * 4.0F; + return biome.temperature - (f + (float)p_150564_2_ - 64.0F) * 0.05F / 30.0F; + } + else + { + return biome.temperature; + } + } + +} |