// Path: src/main/java/CustomOreGen/Util/HeightScaledPDist.java
// public class HeightScaledPDist implements Copyable<HeightScaledPDist> {
// 
// 	public PDist pdist;
// 	public HeightScale scaleFrom = new BaseHeightScale();
// 	public HeightScale scaleTo = new BaseHeightScale();
// 
// 	public HeightScaledPDist(float mean, float range, Type type)
//     {
//         this.pdist = new PDist(mean, range, type);
//     }
// 
//     public HeightScaledPDist(float mean, float range)
//     {
//         this(mean, range, Type.uniform);
//     }
// 
//     public HeightScaledPDist()
//     {
//         this(0.0F, 0.0F, Type.uniform);
//     }
// 
// 	@Override
// 	public void copyFrom(HeightScaledPDist other) {
// 		this.pdist.copyFrom(other.pdist);
// 		this.scaleFrom = other.scaleFrom;
// 		this.scaleTo = other.scaleTo;
// 	}
// 	
// 	private float scale(float val, World world, int x, int z) {
// 		return val * scaleTo.getHeight(world, x, z) / scaleFrom.getHeight(world, x, z);
// 	}
// 	
// 	public float getValue(Random rand, World world, int x, int z) {
// 		return scale(pdist.getValue(rand), world, x, z); 
// 	}
// 
// 	public float getValue(Random rand, World world, float x, float z) {
// 		return scale(pdist.getValue(rand), world, MathHelper.floor(x), MathHelper.floor(z)); 
// 	}
// 	
// 	public float getMax(World world, int x, int z) {
// 		return scale(pdist.getMax(), world, x, z);
// 	}
// 
// 	public float getMin(World world, int x, int z) {
// 		return scale(pdist.getMin(), world, x, z);
// 	}
// 	
// 	public HeightScaledPDist set(float mean, float range, Type type, HeightScale scaleTo) {
// 		this.set(mean, range, type);
// 		this.scaleTo = scaleTo;
// 		return this;
// 	}
// 
// 	public HeightScaledPDist set(float mean, float range, Type type) {
// 		pdist.set(mean, range, type);
// 		return this;
// 	}
// 	
// 	public int getIntValue(Random rand, World world, int x, int z)
//     {
//         float fval = this.getValue(rand, world, x, z);
//         return PDist.roundToInt(fval, rand);
//     }
// 	
// 	public String toString() {
// 		return pdist.toString() + " * " + scaleTo.getName() + "/" + scaleFrom.getName();
// 	}
// 	
// }
// 
// Path: src/main/java/CustomOreGen/Util/VolumeHelper.java
// public class VolumeHelper {
// 	public static double sphericalVolume(double r) {
// 		return ellipsoidalVolume(r, r, r);
// 	}
// 	
// 	public static double ellipsoidalVolume(double a, double b, double c) {
// 		return (4.0/3.0) * Math.PI * a * b * c;
// 	}
// 
// 	public static double cylindricalVolume(double h, double r) {
// 		return h * Math.PI * r * r;
// 	}
// }


import java.util.Random;
import CustomOreGen.Server.DistributionSettingMap.DistributionSetting;
import CustomOreGen.Util.HeightScaledPDist;
import CustomOreGen.Util.IGeometryBuilder;
import CustomOreGen.Util.IGeometryBuilder.PrimitiveType;
import CustomOreGen.Util.PDist;
import CustomOreGen.Util.PDist.Type;
import CustomOreGen.Util.Transform;
import CustomOreGen.Util.VolumeHelper;
import CustomOreGen.Util.WireframeShapes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
		return this.getAverageBranchLength(this.brLength.mean);
	}
	
	private int getAverageBranchLength(float length)
    {
        int avgBrLength = 0;
        
        while (length > 0.0F)
        {
        	float segLen = this.sgLength.mean;
            
        	if (segLen > length)
            {
                segLen = length;
            }
        	avgBrLength += segLen;
            length -= segLen;
            
            for (int axisTheta = Math.round(this.sgForkFrequency.mean); axisTheta > 0; --axisTheta)
            {
                float fkLenMult = this.sgForkLenMult.mean;
                avgBrLength += this.getAverageBranchLength(length * (fkLenMult > 1.0F ? 1.0F : fkLenMult));
            }
        }
        return avgBrLength;
    }

	@Override
	public double getAverageOreCount() {
		double mlVolume = VolumeHelper.sphericalVolume(this.mlSize.mean * this.orRadiusMult.mean);
// Path: src/main/java/CustomOreGen/Util/HeightScaledPDist.java
// public class HeightScaledPDist implements Copyable<HeightScaledPDist> {
// 
// 	public PDist pdist;
// 	public HeightScale scaleFrom = new BaseHeightScale();
// 	public HeightScale scaleTo = new BaseHeightScale();
// 
// 	public HeightScaledPDist(float mean, float range, Type type)
//     {
//         this.pdist = new PDist(mean, range, type);
//     }
// 
//     public HeightScaledPDist(float mean, float range)
//     {
//         this(mean, range, Type.uniform);
//     }
// 
//     public HeightScaledPDist()
//     {
//         this(0.0F, 0.0F, Type.uniform);
//     }
// 
// 	@Override
// 	public void copyFrom(HeightScaledPDist other) {
// 		this.pdist.copyFrom(other.pdist);
// 		this.scaleFrom = other.scaleFrom;
// 		this.scaleTo = other.scaleTo;
// 	}
// 	
// 	private float scale(float val, World world, int x, int z) {
// 		return val * scaleTo.getHeight(world, x, z) / scaleFrom.getHeight(world, x, z);
// 	}
// 	
// 	public float getValue(Random rand, World world, int x, int z) {
// 		return scale(pdist.getValue(rand), world, x, z); 
// 	}
// 
// 	public float getValue(Random rand, World world, float x, float z) {
// 		return scale(pdist.getValue(rand), world, MathHelper.floor(x), MathHelper.floor(z)); 
// 	}
// 	
// 	public float getMax(World world, int x, int z) {
// 		return scale(pdist.getMax(), world, x, z);
// 	}
// 
// 	public float getMin(World world, int x, int z) {
// 		return scale(pdist.getMin(), world, x, z);
// 	}
// 	
// 	public HeightScaledPDist set(float mean, float range, Type type, HeightScale scaleTo) {
// 		this.set(mean, range, type);
// 		this.scaleTo = scaleTo;
// 		return this;
// 	}
// 
// 	public HeightScaledPDist set(float mean, float range, Type type) {
// 		pdist.set(mean, range, type);
// 		return this;
// 	}
// 	
// 	public int getIntValue(Random rand, World world, int x, int z)
//     {
//         float fval = this.getValue(rand, world, x, z);
//         return PDist.roundToInt(fval, rand);
//     }
// 	
// 	public String toString() {
// 		return pdist.toString() + " * " + scaleTo.getName() + "/" + scaleFrom.getName();
// 	}
// 	
// }
// 
// Path: src/main/java/CustomOreGen/Util/VolumeHelper.java
// public class VolumeHelper {
// 	public static double sphericalVolume(double r) {
// 		return ellipsoidalVolume(r, r, r);
// 	}
// 	
// 	public static double ellipsoidalVolume(double a, double b, double c) {
// 		return (4.0/3.0) * Math.PI * a * b * c;
// 	}
// 
// 	public static double cylindricalVolume(double h, double r) {
// 		return h * Math.PI * r * r;
// 	}
// }


// Path: src/main/java/CustomOreGen/Server/MapGenVeins.java
import java.util.Random;
import CustomOreGen.Server.DistributionSettingMap.DistributionSetting;
import CustomOreGen.Util.HeightScaledPDist;
import CustomOreGen.Util.IGeometryBuilder;
import CustomOreGen.Util.IGeometryBuilder.PrimitiveType;
import CustomOreGen.Util.PDist;
import CustomOreGen.Util.PDist.Type;
import CustomOreGen.Util.Transform;
import CustomOreGen.Util.VolumeHelper;
import CustomOreGen.Util.WireframeShapes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;

		return this.getAverageBranchLength(this.brLength.mean);
	}
	
	private int getAverageBranchLength(float length)
    {
        int avgBrLength = 0;
        
        while (length > 0.0F)
        {
        	float segLen = this.sgLength.mean;
            
        	if (segLen > length)
            {
                segLen = length;
            }
        	avgBrLength += segLen;
            length -= segLen;
            
            for (int axisTheta = Math.round(this.sgForkFrequency.mean); axisTheta > 0; --axisTheta)
            {
                float fkLenMult = this.sgForkLenMult.mean;
                avgBrLength += this.getAverageBranchLength(length * (fkLenMult > 1.0F ? 1.0F : fkLenMult));
            }
        }
        return avgBrLength;
    }

	@Override
	public double getAverageOreCount() {
		double mlVolume = VolumeHelper.sphericalVolume(this.mlSize.mean * this.orRadiusMult.mean);
		double brVolume = VolumeHelper.cylindricalVolume(this.getAverageBranchLength(), this.sgRadius.mean * this.orRadiusMult.mean);