    001    package net.minecraft.src;
    002
    003    public class GenLayerZoom extends GenLayer
    004    {
    005        public GenLayerZoom(long par1, GenLayer par3GenLayer)
    006        {
    007            super(par1);
    008            super.parent = par3GenLayer;
    009        }
    010
    011        /**
    012         * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
    013         * amounts, or biomeList[] indices based on the particular GenLayer subclass.
    014         */
    015        public int[] getInts(int par1, int par2, int par3, int par4)
    016        {
    017            int var5 = par1 >> 1;
    018            int var6 = par2 >> 1;
    019            int var7 = (par3 >> 1) + 3;
    020            int var8 = (par4 >> 1) + 3;
    021            int[] var9 = this.parent.getInts(var5, var6, var7, var8);
    022            int[] var10 = IntCache.getIntCache(var7 * 2 * var8 * 2);
    023            int var11 = var7 << 1;
    024            int var13;
    025
    026            for (int var12 = 0; var12 < var8 - 1; ++var12)
    027            {
    028                var13 = var12 << 1;
    029                int var14 = var13 * var11;
    030                int var15 = var9[0 + (var12 + 0) * var7];
    031                int var16 = var9[0 + (var12 + 1) * var7];
    032
    033                for (int var17 = 0; var17 < var7 - 1; ++var17)
    034                {
    035                    this.initChunkSeed((long)(var17 + var5 << 1), (long)(var12 + var6 << 1));
    036                    int var18 = var9[var17 + 1 + (var12 + 0) * var7];
    037                    int var19 = var9[var17 + 1 + (var12 + 1) * var7];
    038                    var10[var14] = var15;
    039                    var10[var14++ + var11] = this.choose(var15, var16);
    040                    var10[var14] = this.choose(var15, var18);
    041                    var10[var14++ + var11] = this.func_75916_b(var15, var18, var16, var19);
    042                    var15 = var18;
    043                    var16 = var19;
    044                }
    045            }
    046
    047            int[] var20 = IntCache.getIntCache(par3 * par4);
    048
    049            for (var13 = 0; var13 < par4; ++var13)
    050            {
    051                System.arraycopy(var10, (var13 + (par2 & 1)) * (var7 << 1) + (par1 & 1), var20, var13 * par3, par3);
    052            }
    053
    054            return var20;
    055        }
    056
    057        /**
    058         * Chooses one of the two inputs randomly.
    059         */
    060        protected int choose(int par1, int par2)
    061        {
    062            return this.nextInt(2) == 0 ? par1 : par2;
    063        }
    064
    065        protected int func_75916_b(int par1, int par2, int par3, int par4)
    066        {
    067            if (par2 == par3 && par3 == par4)
    068            {
    069                return par2;
    070            }
    071            else if (par1 == par2 && par1 == par3)
    072            {
    073                return par1;
    074            }
    075            else if (par1 == par2 && par1 == par4)
    076            {
    077                return par1;
    078            }
    079            else if (par1 == par3 && par1 == par4)
    080            {
    081                return par1;
    082            }
    083            else if (par1 == par2 && par3 != par4)
    084            {
    085                return par1;
    086            }
    087            else if (par1 == par3 && par2 != par4)
    088            {
    089                return par1;
    090            }
    091            else if (par1 == par4 && par2 != par3)
    092            {
    093                return par1;
    094            }
    095            else if (par2 == par1 && par3 != par4)
    096            {
    097                return par2;
    098            }
    099            else if (par2 == par3 && par1 != par4)
    100            {
    101                return par2;
    102            }
    103            else if (par2 == par4 && par1 != par3)
    104            {
    105                return par2;
    106            }
    107            else if (par3 == par1 && par2 != par4)
    108            {
    109                return par3;
    110            }
    111            else if (par3 == par2 && par1 != par4)
    112            {
    113                return par3;
    114            }
    115            else if (par3 == par4 && par1 != par2)
    116            {
    117                return par3;
    118            }
    119            else if (par4 == par1 && par2 != par3)
    120            {
    121                return par3;
    122            }
    123            else if (par4 == par2 && par1 != par3)
    124            {
    125                return par3;
    126            }
    127            else if (par4 == par3 && par1 != par2)
    128            {
    129                return par3;
    130            }
    131            else
    132            {
    133                int var5 = this.nextInt(4);
    134                return var5 == 0 ? par1 : (var5 == 1 ? par2 : (var5 == 2 ? par3 : par4));
    135            }
    136        }
    137
    138        public static GenLayer func_75915_a(long par0, GenLayer par2GenLayer, int par3)
    139        {
    140            Object var4 = par2GenLayer;
    141
    142            for (int var5 = 0; var5 < par3; ++var5)
    143            {
    144                var4 = new GenLayerZoom(par0 + (long)var5, (GenLayer)var4);
    145            }
    146
    147            return (GenLayer)var4;
    148        }
    149    }