001package net.minecraft.world.gen.layer;
002
003import net.minecraft.world.biome.BiomeGenBase;
004
005public class GenLayerShore extends GenLayer
006{
007    public GenLayerShore(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[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
020        int[] aint1 = IntCache.getIntCache(par3 * par4);
021
022        for (int i1 = 0; i1 < par4; ++i1)
023        {
024            for (int j1 = 0; j1 < par3; ++j1)
025            {
026                this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
027                int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)];
028                int l1;
029                int i2;
030                int j2;
031                int k2;
032
033                if (k1 == BiomeGenBase.mushroomIsland.biomeID)
034                {
035                    l1 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)];
036                    i2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)];
037                    j2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)];
038                    k2 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)];
039
040                    if (l1 != BiomeGenBase.ocean.biomeID && i2 != BiomeGenBase.ocean.biomeID && j2 != BiomeGenBase.ocean.biomeID && k2 != BiomeGenBase.ocean.biomeID)
041                    {
042                        aint1[j1 + i1 * par3] = k1;
043                    }
044                    else
045                    {
046                        aint1[j1 + i1 * par3] = BiomeGenBase.mushroomIslandShore.biomeID;
047                    }
048                }
049                else if (k1 != BiomeGenBase.ocean.biomeID && k1 != BiomeGenBase.river.biomeID && k1 != BiomeGenBase.swampland.biomeID && k1 != BiomeGenBase.extremeHills.biomeID)
050                {
051                    l1 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)];
052                    i2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)];
053                    j2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)];
054                    k2 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)];
055
056                    if (l1 != BiomeGenBase.ocean.biomeID && i2 != BiomeGenBase.ocean.biomeID && j2 != BiomeGenBase.ocean.biomeID && k2 != BiomeGenBase.ocean.biomeID)
057                    {
058                        aint1[j1 + i1 * par3] = k1;
059                    }
060                    else
061                    {
062                        aint1[j1 + i1 * par3] = BiomeGenBase.beach.biomeID;
063                    }
064                }
065                else if (k1 == BiomeGenBase.extremeHills.biomeID)
066                {
067                    l1 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)];
068                    i2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)];
069                    j2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)];
070                    k2 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)];
071
072                    if (l1 == BiomeGenBase.extremeHills.biomeID && i2 == BiomeGenBase.extremeHills.biomeID && j2 == BiomeGenBase.extremeHills.biomeID && k2 == BiomeGenBase.extremeHills.biomeID)
073                    {
074                        aint1[j1 + i1 * par3] = k1;
075                    }
076                    else
077                    {
078                        aint1[j1 + i1 * par3] = BiomeGenBase.extremeHillsEdge.biomeID;
079                    }
080                }
081                else
082                {
083                    aint1[j1 + i1 * par3] = k1;
084                }
085            }
086        }
087
088        return aint1;
089    }
090}