001package net.minecraft.world.gen.layer;
002
003import net.minecraft.world.WorldType;
004import net.minecraft.world.biome.BiomeGenBase;
005
006public class GenLayerBiome extends GenLayer
007{
008    /** this sets all the biomes that are allowed to appear in the overworld */
009    private BiomeGenBase[] allowedBiomes;
010
011    public GenLayerBiome(long par1, GenLayer par3GenLayer, WorldType par4WorldType)
012    {
013        super(par1);
014        this.allowedBiomes = par4WorldType.getBiomesForWorldType();
015        this.parent = par3GenLayer;
016    }
017
018    /**
019     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
020     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
021     */
022    public int[] getInts(int par1, int par2, int par3, int par4)
023    {
024        int[] aint = this.parent.getInts(par1, par2, par3, par4);
025        int[] aint1 = IntCache.getIntCache(par3 * par4);
026
027        for (int i1 = 0; i1 < par4; ++i1)
028        {
029            for (int j1 = 0; j1 < par3; ++j1)
030            {
031                this.initChunkSeed((long)(j1 + par1), (long)(i1 + par2));
032                int k1 = aint[j1 + i1 * par3];
033
034                if (k1 == 0)
035                {
036                    aint1[j1 + i1 * par3] = 0;
037                }
038                else if (k1 == BiomeGenBase.mushroomIsland.biomeID)
039                {
040                    aint1[j1 + i1 * par3] = k1;
041                }
042                else if (k1 == 1)
043                {
044                    aint1[j1 + i1 * par3] = this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID;
045                }
046                else
047                {
048                    int l1 = this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID;
049
050                    if (l1 == BiomeGenBase.taiga.biomeID)
051                    {
052                        aint1[j1 + i1 * par3] = l1;
053                    }
054                    else
055                    {
056                        aint1[j1 + i1 * par3] = BiomeGenBase.icePlains.biomeID;
057                    }
058                }
059            }
060        }
061
062        return aint1;
063    }
064}