    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 i1 = par1 - 1;
    020        int j1 = par2 - 1;
    021        int k1 = par3 + 2;
    022        int l1 = par4 + 2;
    023        int[] aint = this.parent.getInts(i1, j1, k1, l1);
    024        int[] aint1 = IntCache.getIntCache(par3 * par4);
    025
    026        for (int i2 = 0; i2 < par4; ++i2)
    027        {
    028            for (int j2 = 0; j2 < par3; ++j2)
    029            {
    030                int k2 = aint[j2 + 0 + (i2 + 0) * k1];
    031                int l2 = aint[j2 + 2 + (i2 + 0) * k1];
    032                int i3 = aint[j2 + 0 + (i2 + 2) * k1];
    033                int j3 = aint[j2 + 2 + (i2 + 2) * k1];
    034                int k3 = aint[j2 + 1 + (i2 + 1) * k1];
    035                this.initChunkSeed((long)(j2 + par1), (long)(i2 + par2));
    036
    037                if (k3 == 0 && (k2 != 0 || l2 != 0 || i3 != 0 || j3 != 0))
    038                {
    039                    int l3 = 1;
    040                    int i4 = 1;
    041
    042                    if (k2 != 0 && this.nextInt(l3++) == 0)
    043                    {
    044                        i4 = k2;
    045                    }
    046
    047                    if (l2 != 0 && this.nextInt(l3++) == 0)
    048                    {
    049                        i4 = l2;
    050                    }
    051
    052                    if (i3 != 0 && this.nextInt(l3++) == 0)
    053                    {
    054                        i4 = i3;
    055                    }
    056
    057                    if (j3 != 0 && this.nextInt(l3++) == 0)
    058                    {
    059                        i4 = j3;
    060                    }
    061
    062                    if (this.nextInt(3) == 0)
    063                    {
    064                        aint1[j2 + i2 * par3] = i4;
    065                    }
    066                    else if (i4 == BiomeGenBase.icePlains.biomeID)
    067                    {
    068                        aint1[j2 + i2 * par3] = BiomeGenBase.frozenOcean.biomeID;
    069                    }
    070                    else
    071                    {
    072                        aint1[j2 + i2 * par3] = 0;
    073                    }
    074                }
    075                else if (k3 > 0 && (k2 == 0 || l2 == 0 || i3 == 0 || j3 == 0))
    076                {
    077                    if (this.nextInt(5) == 0)
    078                    {
    079                        if (k3 == BiomeGenBase.icePlains.biomeID)
    080                        {
    081                            aint1[j2 + i2 * par3] = BiomeGenBase.frozenOcean.biomeID;
    082                        }
    083                        else
    084                        {
    085                            aint1[j2 + i2 * par3] = 0;
    086                        }
    087                    }
    088                    else
    089                    {
    090                        aint1[j2 + i2 * par3] = k3;
    091                    }
    092                }
    093                else
    094                {
    095                    aint1[j2 + i2 * par3] = k3;
    096                }
    097            }
    098        }
    099
    100        return aint1;
    101    }
    102}