package com.amee.minecraft;

import java.text.DecimalFormat;

public class Atmosphere {

	private static float total = 0.0f;
	private static float pollutionRatio = 0.0f;

	public static void init() {
		total = 0.0f;
		pollutionRatio = 0.0f;
	}

	public static void addToTotal(float value)
	{
		total += value;
		pollutionRatio = total / 1000.0f;
	}

	private static void updatePollutionRatio() {
		pollutionRatio = total / 1000.0f;
		if (pollutionRatio < 0.0)
		{
			pollutionRatio = 0.0f;
		}
		if (pollutionRatio > 1.0)
		{
			pollutionRatio = 1.0f;
		}
	}

	public static String totalAsString() 
	{
		return new DecimalFormat("#0.00").format(total) + "kg";
	}

	public static float cloudColourScale() {
		return 1.0f - pollutionRatio;
	}

	public static float fogColourScale() {
		return 1.0f - pollutionRatio;
	}

	public static float cloudHeightOffset() {
		return -(pollutionRatio*40.0f);    	
	}

}

@@ -301,25 +301,31 @@
 += value;%0A%09%09
-p
+updateP
 ollutionRati
@@ -325,34 +325,18 @@
 ionRatio
- = total / 1000.0f
+()
 ;%0A%09%7D%0A%0A%09p

Stop pollution ratio overrunning