001package net.minecraft.world.gen.layer;
002
003import net.minecraft.world.biome.BiomeGenBase;
004
005public class GenLayerRiverMix extends GenLayer
006{
007    private GenLayer biomePatternGeneratorChain;
008    private GenLayer riverPatternGeneratorChain;
009
010    public GenLayerRiverMix(long par1, GenLayer par3GenLayer, GenLayer par4GenLayer)
011    {
012        super(par1);
013        this.biomePatternGeneratorChain = par3GenLayer;
014        this.riverPatternGeneratorChain = par4GenLayer;
015    }
016
017    /**
018     * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an
019     * argument).
020     */
021    public void initWorldGenSeed(long par1)
022    {
023        this.biomePatternGeneratorChain.initWorldGenSeed(par1);
024        this.riverPatternGeneratorChain.initWorldGenSeed(par1);
025        super.initWorldGenSeed(par1);
026    }
027
028    /**
029     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
030     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
031     */
032    public int[] getInts(int par1, int par2, int par3, int par4)
033    {
034        int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
035        int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
036        int[] aint2 = IntCache.getIntCache(par3 * par4);
037
038        for (int i1 = 0; i1 < par3 * par4; ++i1)
039        {
040            if (aint[i1] == BiomeGenBase.ocean.biomeID)
041            {
042                aint2[i1] = aint[i1];
043            }
044            else if (aint1[i1] >= 0)
045            {
046                if (aint[i1] == BiomeGenBase.icePlains.biomeID)
047                {
048                    aint2[i1] = BiomeGenBase.frozenRiver.biomeID;
049                }
050                else if (aint[i1] != BiomeGenBase.mushroomIsland.biomeID && aint[i1] != BiomeGenBase.mushroomIslandShore.biomeID)
051                {
052                    aint2[i1] = aint1[i1];
053                }
054                else
055                {
056                    aint2[i1] = BiomeGenBase.mushroomIslandShore.biomeID;
057                }
058            }
059            else
060            {
061                aint2[i1] = aint[i1];
062            }
063        }
064
065        return aint2;
066    }
067}