GenLayerVoronoiZoom .java

net.minecraft.world.gen.layer.GenLayerVoronoiZoom (class, 96 lines): extends GenLayer. members: getInts.

net.minecraft.world.gen.layerclass96 linescommonextends GenLayer3.9 KB

API Surface (1)

int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)

Code Graph: Dependencies (2)

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

Full Source

GenLayerVoronoiZoom.java96 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.layer;
2
3
public class GenLayerVoronoiZoom extends GenLayer
4
{
5
    public GenLayerVoronoiZoom(long p_i2133_1_, GenLayer p_i2133_3_)
6
    {
7
        super(p_i2133_1_);
8
        super.parent = p_i2133_3_;
9
    }
10
11
    /**
12
     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
13
     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
14
     */
15
    public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
16
    {
17
        areaX = areaX - 2;
18
        areaY = areaY - 2;
19
        int i = areaX >> 2;
20
        int j = areaY >> 2;
21
        int k = (areaWidth >> 2) + 2;
22
        int l = (areaHeight >> 2) + 2;
23
        int[] aint = this.parent.getInts(i, j, k, l);
24
        int i1 = k - 1 << 2;
25
        int j1 = l - 1 << 2;
26
        int[] aint1 = IntCache.getIntCache(i1 * j1);
27
28
        for (int k1 = 0; k1 < l - 1; ++k1)
29
        {
30
            int l1 = 0;
31
            int i2 = aint[l1 + 0 + (k1 + 0) * k];
32
33
            for (int j2 = aint[l1 + 0 + (k1 + 1) * k]; l1 < k - 1; ++l1)
34
            {
35
                double d0 = 3.6D;
36
                this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j << 2));
37
                double d1 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
38
                double d2 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
39
                this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j << 2));
40
                double d3 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
41
                double d4 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
42
                this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j + 1 << 2));
43
                double d5 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D;
44
                double d6 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
45
                this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j + 1 << 2));
46
                double d7 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
47
                double d8 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D;
48
                int k2 = aint[l1 + 1 + (k1 + 0) * k] & 255;
49
                int l2 = aint[l1 + 1 + (k1 + 1) * k] & 255;
50
51
                for (int i3 = 0; i3 < 4; ++i3)
52
                {
53
                    int j3 = ((k1 << 2) + i3) * i1 + (l1 << 2);
54
55
                    for (int k3 = 0; k3 < 4; ++k3)
56
                    {
57
                        double d9 = ((double)i3 - d2) * ((double)i3 - d2) + ((double)k3 - d1) * ((double)k3 - d1);
58
                        double d10 = ((double)i3 - d4) * ((double)i3 - d4) + ((double)k3 - d3) * ((double)k3 - d3);
59
                        double d11 = ((double)i3 - d6) * ((double)i3 - d6) + ((double)k3 - d5) * ((double)k3 - d5);
60
                        double d12 = ((double)i3 - d8) * ((double)i3 - d8) + ((double)k3 - d7) * ((double)k3 - d7);
61
62
                        if (d9 < d10 && d9 < d11 && d9 < d12)
63
                        {
64
                            aint1[j3++] = i2;
65
                        }
66
                        else if (d10 < d9 && d10 < d11 && d10 < d12)
67
                        {
68
                            aint1[j3++] = k2;
69
                        }
70
                        else if (d11 < d9 && d11 < d10 && d11 < d12)
71
                        {
72
                            aint1[j3++] = j2;
73
                        }
74
                        else
75
                        {
76
                            aint1[j3++] = l2;
77
                        }
78
                    }
79
                }
80
81
                i2 = k2;
82
                j2 = l2;
83
            }
84
        }
85
86
        int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);
87
88
        for (int l3 = 0; l3 < areaHeight; ++l3)
89
        {
90
            System.arraycopy(aint1, (l3 + (areaY & 3)) * i1 + (areaX & 3), aint2, l3 * areaWidth, areaWidth);
91
        }
92
93
        return aint2;
94
    }
95
}
96

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