GenLayerEdge .java

net.minecraft.world.gen.layer.GenLayerEdge (class, 140 lines): extends GenLayer. members: field_151627_c, Mode, getInts.

net.minecraft.world.gen.layerclass140 linescommonextends GenLayer4.4 KB

API Surface (1)

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

Fields & Constants (1)

field_151627_c

Code Graph: Dependencies (2)

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

Full Source

GenLayerEdge.java140 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.layer;
2
3
public class GenLayerEdge extends GenLayer
4
{
5
    private final GenLayerEdge.Mode field_151627_c;
6
7
    public GenLayerEdge(long p_i45474_1_, GenLayer p_i45474_3_, GenLayerEdge.Mode p_i45474_4_)
8
    {
9
        super(p_i45474_1_);
10
        this.parent = p_i45474_3_;
11
        this.field_151627_c = p_i45474_4_;
12
    }
13
14
    /**
15
     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
16
     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
17
     */
18
    public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
19
    {
20
        switch (this.field_151627_c)
21
        {
22
            case COOL_WARM:
23
            default:
24
                return this.getIntsCoolWarm(areaX, areaY, areaWidth, areaHeight);
25
26
            case HEAT_ICE:
27
                return this.getIntsHeatIce(areaX, areaY, areaWidth, areaHeight);
28
29
            case SPECIAL:
30
                return this.getIntsSpecial(areaX, areaY, areaWidth, areaHeight);
31
        }
32
    }
33
34
    private int[] getIntsCoolWarm(int p_151626_1_, int p_151626_2_, int p_151626_3_, int p_151626_4_)
35
    {
36
        int i = p_151626_1_ - 1;
37
        int j = p_151626_2_ - 1;
38
        int k = 1 + p_151626_3_ + 1;
39
        int l = 1 + p_151626_4_ + 1;
40
        int[] aint = this.parent.getInts(i, j, k, l);
41
        int[] aint1 = IntCache.getIntCache(p_151626_3_ * p_151626_4_);
42
43
        for (int i1 = 0; i1 < p_151626_4_; ++i1)
44
        {
45
            for (int j1 = 0; j1 < p_151626_3_; ++j1)
46
            {
47
                this.initChunkSeed((long)(j1 + p_151626_1_), (long)(i1 + p_151626_2_));
48
                int k1 = aint[j1 + 1 + (i1 + 1) * k];
49
50
                if (k1 == 1)
51
                {
52
                    int l1 = aint[j1 + 1 + (i1 + 1 - 1) * k];
53
                    int i2 = aint[j1 + 1 + 1 + (i1 + 1) * k];
54
                    int j2 = aint[j1 + 1 - 1 + (i1 + 1) * k];
55
                    int k2 = aint[j1 + 1 + (i1 + 1 + 1) * k];
56
                    boolean flag = l1 == 3 || i2 == 3 || j2 == 3 || k2 == 3;
57
                    boolean flag1 = l1 == 4 || i2 == 4 || j2 == 4 || k2 == 4;
58
59
                    if (flag || flag1)
60
                    {
61
                        k1 = 2;
62
                    }
63
                }
64
65
                aint1[j1 + i1 * p_151626_3_] = k1;
66
            }
67
        }
68
69
        return aint1;
70
    }
71
72
    private int[] getIntsHeatIce(int p_151624_1_, int p_151624_2_, int p_151624_3_, int p_151624_4_)
73
    {
74
        int i = p_151624_1_ - 1;
75
        int j = p_151624_2_ - 1;
76
        int k = 1 + p_151624_3_ + 1;
77
        int l = 1 + p_151624_4_ + 1;
78
        int[] aint = this.parent.getInts(i, j, k, l);
79
        int[] aint1 = IntCache.getIntCache(p_151624_3_ * p_151624_4_);
80
81
        for (int i1 = 0; i1 < p_151624_4_; ++i1)
82
        {
83
            for (int j1 = 0; j1 < p_151624_3_; ++j1)
84
            {
85
                int k1 = aint[j1 + 1 + (i1 + 1) * k];
86
87
                if (k1 == 4)
88
                {
89
                    int l1 = aint[j1 + 1 + (i1 + 1 - 1) * k];
90
                    int i2 = aint[j1 + 1 + 1 + (i1 + 1) * k];
91
                    int j2 = aint[j1 + 1 - 1 + (i1 + 1) * k];
92
                    int k2 = aint[j1 + 1 + (i1 + 1 + 1) * k];
93
                    boolean flag = l1 == 2 || i2 == 2 || j2 == 2 || k2 == 2;
94
                    boolean flag1 = l1 == 1 || i2 == 1 || j2 == 1 || k2 == 1;
95
96
                    if (flag1 || flag)
97
                    {
98
                        k1 = 3;
99
                    }
100
                }
101
102
                aint1[j1 + i1 * p_151624_3_] = k1;
103
            }
104
        }
105
106
        return aint1;
107
    }
108
109
    private int[] getIntsSpecial(int p_151625_1_, int p_151625_2_, int p_151625_3_, int p_151625_4_)
110
    {
111
        int[] aint = this.parent.getInts(p_151625_1_, p_151625_2_, p_151625_3_, p_151625_4_);
112
        int[] aint1 = IntCache.getIntCache(p_151625_3_ * p_151625_4_);
113
114
        for (int i = 0; i < p_151625_4_; ++i)
115
        {
116
            for (int j = 0; j < p_151625_3_; ++j)
117
            {
118
                this.initChunkSeed((long)(j + p_151625_1_), (long)(i + p_151625_2_));
119
                int k = aint[j + i * p_151625_3_];
120
121
                if (k != 0 && this.nextInt(13) == 0)
122
                {
123
                    k |= 1 + this.nextInt(15) << 8 & 3840;
124
                }
125
126
                aint1[j + i * p_151625_3_] = k;
127
            }
128
        }
129
130
        return aint1;
131
    }
132
133
    public static enum Mode
134
    {
135
        COOL_WARM,
136
        HEAT_ICE,
137
        SPECIAL;
138
    }
139
}
140

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