    001package net.minecraft.world.gen.layer;
    002
    003import net.minecraft.world.biome.BiomeGenBase;
    004
    005public class GenLayerAddIsland extends GenLayer
    006{
    007    public GenLayerAddIsland(long par1, GenLayer par3GenLayer)
    008    {
    009        super(par1);
    010        this.parent = par3GenLayer;
    011    }
    012
    013    /**
    014     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
    015     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
    016     */
    017    public int[] getInts(int par1, int par2, int par3, int par4)
    018    {
    019        int var5 = par1 - 1;
    020        int var6 = par2 - 1;
    021        int var7 = par3 + 2;
    022        int var8 = par4 + 2;
    023        int[] var9 = this.parent.getInts(var5, var6, var7, var8);
    024        int[] var10 = IntCache.getIntCache(par3 * par4);
    025
    026        for (int var11 = 0; var11 < par4; ++var11)
    027        {
    028            for (int var12 = 0; var12 < par3; ++var12)
    029            {
    030                int var13 = var9[var12 + 0 + (var11 + 0) * var7];
    031                int var14 = var9[var12 + 2 + (var11 + 0) * var7];
    032                int var15 = var9[var12 + 0 + (var11 + 2) * var7];
    033                int var16 = var9[var12 + 2 + (var11 + 2) * var7];
    034                int var17 = var9[var12 + 1 + (var11 + 1) * var7];
    035                this.initChunkSeed((long)(var12 + par1), (long)(var11 + par2));
    036
    037                if (var17 == 0 && (var13 != 0 || var14 != 0 || var15 != 0 || var16 != 0))
    038                {
    039                    int var18 = 1;
    040                    int var19 = 1;
    041
    042                    if (var13 != 0 && this.nextInt(var18++) == 0)
    043                    {
    044                        var19 = var13;
    045                    }
    046
    047                    if (var14 != 0 && this.nextInt(var18++) == 0)
    048                    {
    049                        var19 = var14;
    050                    }
    051
    052                    if (var15 != 0 && this.nextInt(var18++) == 0)
    053                    {
    054                        var19 = var15;
    055                    }
    056
    057                    if (var16 != 0 && this.nextInt(var18++) == 0)
    058                    {
    059                        var19 = var16;
    060                    }
    061
    062                    if (this.nextInt(3) == 0)
    063                    {
    064                        var10[var12 + var11 * par3] = var19;
    065                    }
    066                    else if (var19 == BiomeGenBase.icePlains.biomeID)
    067                    {
    068                        var10[var12 + var11 * par3] = BiomeGenBase.frozenOcean.biomeID;
    069                    }
    070                    else
    071                    {
    072                        var10[var12 + var11 * par3] = 0;
    073                    }
    074                }
    075                else if (var17 > 0 && (var13 == 0 || var14 == 0 || var15 == 0 || var16 == 0))
    076                {
    077                    if (this.nextInt(5) == 0)
    078                    {
    079                        if (var17 == BiomeGenBase.icePlains.biomeID)
    080                        {
    081                            var10[var12 + var11 * par3] = BiomeGenBase.frozenOcean.biomeID;
    082                        }
    083                        else
    084                        {
    085                            var10[var12 + var11 * par3] = 0;
    086                        }
    087                    }
    088                    else
    089                    {
    090                        var10[var12 + var11 * par3] = var17;
    091                    }
    092                }
    093                else
    094                {
    095                    var10[var12 + var11 * par3] = var17;
    096                }
    097            }
    098        }
    099
    100        return var10;
    101    }
    102}