NoiseGeneratorOctaves .java

net.minecraft.world.gen.NoiseGeneratorOctaves (class, 73 lines): members: generateNoiseOctaves, generatorCollection, octaves. imports: MathHelper.

net.minecraft.world.genclass73 linescommonextends NoiseGenerator2.4 KB

API Surface (2)

double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int yOffset, int zOffset, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale)
double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int zOffset, int xSize, int zSize, double xScale, double zScale, double p_76305_10_)

Fields & Constants (2)

generatorCollection
octaves

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

NoiseGeneratorOctaves.java73 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen;
2
3
import java.util.Random;
4
import net.minecraft.util.MathHelper;
5
6
public class NoiseGeneratorOctaves extends NoiseGenerator
7
{
8
    /**
9
     * Collection of noise generation functions.  Output is combined to produce different octaves of noise.
10
     */
11
    private NoiseGeneratorImproved[] generatorCollection;
12
    private int octaves;
13
14
    public NoiseGeneratorOctaves(Random seed, int octavesIn)
15
    {
16
        this.octaves = octavesIn;
17
        this.generatorCollection = new NoiseGeneratorImproved[octavesIn];
18
19
        for (int i = 0; i < octavesIn; ++i)
20
        {
21
            this.generatorCollection[i] = new NoiseGeneratorImproved(seed);
22
        }
23
    }
24
25
    /**
26
     * pars:(par2,3,4=noiseOffset ; so that adjacent noise segments connect) (pars5,6,7=x,y,zArraySize),(pars8,10,12 =
27
     * x,y,z noiseScale)
28
     */
29
    public double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int yOffset, int zOffset, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale)
30
    {
31
        if (noiseArray == null)
32
        {
33
            noiseArray = new double[xSize * ySize * zSize];
34
        }
35
        else
36
        {
37
            for (int i = 0; i < noiseArray.length; ++i)
38
            {
39
                noiseArray[i] = 0.0D;
40
            }
41
        }
42
43
        double d3 = 1.0D;
44
45
        for (int j = 0; j < this.octaves; ++j)
46
        {
47
            double d0 = (double)xOffset * d3 * xScale;
48
            double d1 = (double)yOffset * d3 * yScale;
49
            double d2 = (double)zOffset * d3 * zScale;
50
            long k = MathHelper.floor_double_long(d0);
51
            long l = MathHelper.floor_double_long(d2);
52
            d0 = d0 - (double)k;
53
            d2 = d2 - (double)l;
54
            k = k % 16777216L;
55
            l = l % 16777216L;
56
            d0 = d0 + (double)k;
57
            d2 = d2 + (double)l;
58
            this.generatorCollection[j].populateNoiseArray(noiseArray, d0, d1, d2, xSize, ySize, zSize, xScale * d3, yScale * d3, zScale * d3, d3);
59
            d3 /= 2.0D;
60
        }
61
62
        return noiseArray;
63
    }
64
65
    /**
66
     * Bouncer function to the main one with some default arguments.
67
     */
68
    public double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int zOffset, int xSize, int zSize, double xScale, double zScale, double p_76305_10_)
69
    {
70
        return this.generateNoiseOctaves(noiseArray, xOffset, 10, zOffset, xSize, 1, zSize, xScale, 1.0D, zScale);
71
    }
72
}
73

Deobfuscated MCP 1.8.9 source of NoiseGeneratorOctaves from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/gen/NoiseGeneratorOctaves.java), stored verbatim.