Merge pull request #432 from jaquadro/fix-fog-render

Fix fog render and add configuration
This commit is contained in:
Adubbz 2015-03-22 12:48:46 +11:00
commit 48f13d3b7f
2 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package biomesoplenty.client.fog;
import biomesoplenty.common.configuration.BOPConfigurationMisc;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -28,6 +29,11 @@ public class FogHandler
@SubscribeEvent
public void onGetFogColour(FogColors event)
{
if (!BOPConfigurationMisc.fogColors)
{
return;
}
if (event.entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)event.entity;
@ -117,8 +123,11 @@ public class FogHandler
float weightMixed = (distance * 2) * (distance * 2);
float weightDefault = weightMixed - weightBiomeFog;
float fpDistanceBiomeFogAvg = (weightBiomeFog == 0) ? 0 : fpDistanceBiomeFog / weightBiomeFog;
float farPlaneDistance = (fpDistanceBiomeFog * 240 + event.farPlaneDistance * weightDefault) / weightMixed;
float farPlaneDistanceScale = (0.25f * weightBiomeFog + 0.75f * weightDefault) / weightMixed;
float farPlaneDistanceScaleBiome = (0.1f * (1 - fpDistanceBiomeFogAvg) + 0.75f * fpDistanceBiomeFogAvg);
float farPlaneDistanceScale = (farPlaneDistanceScaleBiome * weightBiomeFog + 0.75f * weightDefault) / weightMixed;
fogX = entity.posX;
fogZ = entity.posZ;

View file

@ -11,6 +11,7 @@ public class BOPConfigurationMisc
public static Configuration config;
public static boolean skyColors;
public static boolean fogColors;
//public static boolean achievements;
public static boolean dungeonLoot;
public static boolean titlePanorama;
@ -36,6 +37,7 @@ public class BOPConfigurationMisc
//Hard-Coded Colors
skyColors = config.get("Hard-Coded Colors", "Enable Sky Colors", true).getBoolean(false);
fogColors = config.get("Hard-Coded Colors", "Enable Fog Colors", true).getBoolean(false);
spawnSearchRadius = config.get("Spawn Settings", "Spawn Location Search Radius", 1024, "Must be 256 or higher").getInt();
if (spawnSearchRadius < 256) spawnSearchRadius = 256;