| 1 | package net.minecraft.world.gen.layer;
|
| 2 |
|
| 3 | import net.minecraft.world.biome.BiomeGenBase;
|
| 4 | import org.apache.logging.log4j.LogManager;
|
| 5 | import org.apache.logging.log4j.Logger;
|
| 6 |
|
| 7 | public class GenLayerHills extends GenLayer
|
| 8 | {
|
| 9 | private static final Logger logger = LogManager.getLogger();
|
| 10 | private GenLayer field_151628_d;
|
| 11 |
|
| 12 | public GenLayerHills(long p_i45479_1_, GenLayer p_i45479_3_, GenLayer p_i45479_4_)
|
| 13 | {
|
| 14 | super(p_i45479_1_);
|
| 15 | this.parent = p_i45479_3_;
|
| 16 | this.field_151628_d = p_i45479_4_;
|
| 17 | }
|
| 18 |
|
| 19 | /**
|
| 20 | * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
|
| 21 | * amounts, or biomeList[] indices based on the particular GenLayer subclass.
|
| 22 | */
|
| 23 | public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
|
| 24 | {
|
| 25 | int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
|
| 26 | int[] aint1 = this.field_151628_d.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
|
| 27 | int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);
|
| 28 |
|
| 29 | for (int i = 0; i < areaHeight; ++i)
|
| 30 | {
|
| 31 | for (int j = 0; j < areaWidth; ++j)
|
| 32 | {
|
| 33 | this.initChunkSeed((long)(j + areaX), (long)(i + areaY));
|
| 34 | int k = aint[j + 1 + (i + 1) * (areaWidth + 2)];
|
| 35 | int l = aint1[j + 1 + (i + 1) * (areaWidth + 2)];
|
| 36 | boolean flag = (l - 2) % 29 == 0;
|
| 37 |
|
| 38 | if (k > 255)
|
| 39 | {
|
| 40 | logger.debug("old! " + k);
|
| 41 | }
|
| 42 |
|
| 43 | if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128)
|
| 44 | {
|
| 45 | if (BiomeGenBase.getBiome(k + 128) != null)
|
| 46 | {
|
| 47 | aint2[j + i * areaWidth] = k + 128;
|
| 48 | }
|
| 49 | else
|
| 50 | {
|
| 51 | aint2[j + i * areaWidth] = k;
|
| 52 | }
|
| 53 | }
|
| 54 | else if (this.nextInt(3) != 0 && !flag)
|
| 55 | {
|
| 56 | aint2[j + i * areaWidth] = k;
|
| 57 | }
|
| 58 | else
|
| 59 | {
|
| 60 | int i1 = k;
|
| 61 |
|
| 62 | if (k == BiomeGenBase.desert.biomeID)
|
| 63 | {
|
| 64 | i1 = BiomeGenBase.desertHills.biomeID;
|
| 65 | }
|
| 66 | else if (k == BiomeGenBase.forest.biomeID)
|
| 67 | {
|
| 68 | i1 = BiomeGenBase.forestHills.biomeID;
|
| 69 | }
|
| 70 | else if (k == BiomeGenBase.birchForest.biomeID)
|
| 71 | {
|
| 72 | i1 = BiomeGenBase.birchForestHills.biomeID;
|
| 73 | }
|
| 74 | else if (k == BiomeGenBase.roofedForest.biomeID)
|
| 75 | {
|
| 76 | i1 = BiomeGenBase.plains.biomeID;
|
| 77 | }
|
| 78 | else if (k == BiomeGenBase.taiga.biomeID)
|
| 79 | {
|
| 80 | i1 = BiomeGenBase.taigaHills.biomeID;
|
| 81 | }
|
| 82 | else if (k == BiomeGenBase.megaTaiga.biomeID)
|
| 83 | {
|
| 84 | i1 = BiomeGenBase.megaTaigaHills.biomeID;
|
| 85 | }
|
| 86 | else if (k == BiomeGenBase.coldTaiga.biomeID)
|
| 87 | {
|
| 88 | i1 = BiomeGenBase.coldTaigaHills.biomeID;
|
| 89 | }
|
| 90 | else if (k == BiomeGenBase.plains.biomeID)
|
| 91 | {
|
| 92 | if (this.nextInt(3) == 0)
|
| 93 | {
|
| 94 | i1 = BiomeGenBase.forestHills.biomeID;
|
| 95 | }
|
| 96 | else
|
| 97 | {
|
| 98 | i1 = BiomeGenBase.forest.biomeID;
|
| 99 | }
|
| 100 | }
|
| 101 | else if (k == BiomeGenBase.icePlains.biomeID)
|
| 102 | {
|
| 103 | i1 = BiomeGenBase.iceMountains.biomeID;
|
| 104 | }
|
| 105 | else if (k == BiomeGenBase.jungle.biomeID)
|
| 106 | {
|
| 107 | i1 = BiomeGenBase.jungleHills.biomeID;
|
| 108 | }
|
| 109 | else if (k == BiomeGenBase.ocean.biomeID)
|
| 110 | {
|
| 111 | i1 = BiomeGenBase.deepOcean.biomeID;
|
| 112 | }
|
| 113 | else if (k == BiomeGenBase.extremeHills.biomeID)
|
| 114 | {
|
| 115 | i1 = BiomeGenBase.extremeHillsPlus.biomeID;
|
| 116 | }
|
| 117 | else if (k == BiomeGenBase.savanna.biomeID)
|
| 118 | {
|
| 119 | i1 = BiomeGenBase.savannaPlateau.biomeID;
|
| 120 | }
|
| 121 | else if (biomesEqualOrMesaPlateau(k, BiomeGenBase.mesaPlateau_F.biomeID))
|
| 122 | {
|
| 123 | i1 = BiomeGenBase.mesa.biomeID;
|
| 124 | }
|
| 125 | else if (k == BiomeGenBase.deepOcean.biomeID && this.nextInt(3) == 0)
|
| 126 | {
|
| 127 | int j1 = this.nextInt(2);
|
| 128 |
|
| 129 | if (j1 == 0)
|
| 130 | {
|
| 131 | i1 = BiomeGenBase.plains.biomeID;
|
| 132 | }
|
| 133 | else
|
| 134 | {
|
| 135 | i1 = BiomeGenBase.forest.biomeID;
|
| 136 | }
|
| 137 | }
|
| 138 |
|
| 139 | if (flag && i1 != k)
|
| 140 | {
|
| 141 | if (BiomeGenBase.getBiome(i1 + 128) != null)
|
| 142 | {
|
| 143 | i1 += 128;
|
| 144 | }
|
| 145 | else
|
| 146 | {
|
| 147 | i1 = k;
|
| 148 | }
|
| 149 | }
|
| 150 |
|
| 151 | if (i1 == k)
|
| 152 | {
|
| 153 | aint2[j + i * areaWidth] = k;
|
| 154 | }
|
| 155 | else
|
| 156 | {
|
| 157 | int k2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
|
| 158 | int k1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
|
| 159 | int l1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
|
| 160 | int i2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];
|
| 161 | int j2 = 0;
|
| 162 |
|
| 163 | if (biomesEqualOrMesaPlateau(k2, k))
|
| 164 | {
|
| 165 | ++j2;
|
| 166 | }
|
| 167 |
|
| 168 | if (biomesEqualOrMesaPlateau(k1, k))
|
| 169 | {
|
| 170 | ++j2;
|
| 171 | }
|
| 172 |
|
| 173 | if (biomesEqualOrMesaPlateau(l1, k))
|
| 174 | {
|
| 175 | ++j2;
|
| 176 | }
|
| 177 |
|
| 178 | if (biomesEqualOrMesaPlateau(i2, k))
|
| 179 | {
|
| 180 | ++j2;
|
| 181 | }
|
| 182 |
|
| 183 | if (j2 >= 3)
|
| 184 | {
|
| 185 | aint2[j + i * areaWidth] = i1;
|
| 186 | }
|
| 187 | else
|
| 188 | {
|
| 189 | aint2[j + i * areaWidth] = k;
|
| 190 | }
|
| 191 | }
|
| 192 | }
|
| 193 | }
|
| 194 | }
|
| 195 |
|
| 196 | return aint2;
|
| 197 | }
|
| 198 | }
|
| 199 |
|