package game.worldgen.layer; import game.biome.Biome; public class GenLayerAddSea extends GenLayer { private final int rarity; public GenLayerAddSea(long p_i45472_1_, GenLayer p_i45472_3_, int rarity) { super(p_i45472_1_); this.parent = p_i45472_3_; this.rarity = rarity < 1 ? 1 : rarity; } /** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; int j = areaY - 1; int k = areaWidth + 2; int l = areaHeight + 2; int[] aint = this.parent.getInts(i, j, k, l); int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); for (int i1 = 0; i1 < areaHeight; ++i1) { for (int j1 = 0; j1 < areaWidth; ++j1) { int k1 = aint[j1 + 1 + (i1 + 1 - 1) * (areaWidth + 2)]; int l1 = aint[j1 + 1 + 1 + (i1 + 1) * (areaWidth + 2)]; int i2 = aint[j1 + 1 - 1 + (i1 + 1) * (areaWidth + 2)]; int j2 = aint[j1 + 1 + (i1 + 1 + 1) * (areaWidth + 2)]; int k2 = aint[j1 + 1 + (i1 + 1) * k]; int l2 = 0; if (k1 == 4) { ++l2; } if (l1 == 4) { ++l2; } if (i2 == 4) { ++l2; } if (j2 == 4) { ++l2; } this.initChunkSeed((long)(areaX + j1), (long)(areaY + i1)); if (k2 == 0 && this.nextInt(this.rarity) == 0) { aint1[j1 + i1 * areaWidth] = l2 > 1 ? Biome.frozenSea.id : Biome.sea.id; } else { aint1[j1 + i1 * areaWidth] = k2; } } } return aint1; } }