BiomesOPlenty/common/biomesoplenty/world/noise/NoiseOctaves.java

66 lines
1.3 KiB
Java
Raw Normal View History

2013-05-07 19:14:44 +00:00
package biomesoplenty.world.noise;
2013-05-03 13:00:44 +00:00
import java.util.Random;
import net.minecraft.world.gen.NoiseGenerator;
2013-05-07 19:14:44 +00:00
public class NoiseOctaves extends NoiseGenerator
2013-05-03 13:00:44 +00:00
{
2013-05-31 10:34:02 +00:00
private NoisePerlin generatorCollection[];
private int octaves;
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
public NoiseOctaves(Random random, int i)
{
octaves = i;
generatorCollection = new NoisePerlin[i];
for (int j = 0; j < i; j++)
{
generatorCollection[j] = new NoisePerlin(random);
}
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
public double func_806_a(double d, double d1)
{
double d2 = 0.0D;
double d3 = 1.0D;
for (int i = 0; i < octaves; i++)
{
d2 += generatorCollection[i].func_801_a(d * d3, d1 * d3) / d3;
d3 /= 2D;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
return d2;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
public double[] generateNoiseOctaves(double ad[], double d, double d1, double d2,
int i, int j, int k, double d3, double d4,
double d5)
{
if (ad == null)
{
ad = new double[i * j * k];
}
else
{
for (int l = 0; l < ad.length; l++)
{
ad[l] = 0.0D;
}
}
double d6 = 1.0D;
for (int i1 = 0; i1 < octaves; i1++)
{
generatorCollection[i1].func_805_a(ad, d, d1, d2, i, j, k, d3 * d6, d4 * d6, d5 * d6, d6);
d6 /= 2D;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
return ad;
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
public double[] generateNoiseOctaves(double ad[], int i, int j, int k, int l, double d,
double d1, double d2)
{
return generateNoiseOctaves(ad, i, 10D, j, k, 1, l, d, 1.0D, d1);
}
2013-05-03 13:00:44 +00:00
}