    001    package net.minecraft.src;
    002
    003    import java.util.Arrays;
    004    import java.util.List;
    005    import java.util.Random;
    006
    007    public class WorldChunkManagerHell extends WorldChunkManager
    008    {
    009        /** The biome generator object. */
    010        private BiomeGenBase biomeGenerator;
    011        private float hellTemperature;
    012
    013        /** The rainfall in the world */
    014        private float rainfall;
    015
    016        public WorldChunkManagerHell(BiomeGenBase par1BiomeGenBase, float par2, float par3)
    017        {
    018            this.biomeGenerator = par1BiomeGenBase;
    019            this.hellTemperature = par2;
    020            this.rainfall = par3;
    021        }
    022
    023        /**
    024         * Returns the BiomeGenBase related to the x, z position on the world.
    025         */
    026        public BiomeGenBase getBiomeGenAt(int par1, int par2)
    027        {
    028            return this.biomeGenerator;
    029        }
    030
    031        /**
    032         * Returns an array of biomes for the location input.
    033         */
    034        public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
    035        {
    036            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
    037            {
    038                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
    039            }
    040
    041            Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
    042            return par1ArrayOfBiomeGenBase;
    043        }
    044
    045        /**
    046         * Returns a list of temperatures to use for the specified blocks.  Args: listToReuse, x, y, width, length
    047         */
    048        public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
    049        {
    050            if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
    051            {
    052                par1ArrayOfFloat = new float[par4 * par5];
    053            }
    054
    055            Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, this.hellTemperature);
    056            return par1ArrayOfFloat;
    057        }
    058
    059        /**
    060         * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
    061         */
    062        public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
    063        {
    064            if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
    065            {
    066                par1ArrayOfFloat = new float[par4 * par5];
    067            }
    068
    069            Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, this.rainfall);
    070            return par1ArrayOfFloat;
    071        }
    072
    073        /**
    074         * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
    075         * WorldChunkManager Args: oldBiomeList, x, z, width, depth
    076         */
    077        public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
    078        {
    079            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
    080            {
    081                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
    082            }
    083
    084            Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
    085            return par1ArrayOfBiomeGenBase;
    086        }
    087
    088        /**
    089         * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
    090         * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
    091         */
    092        public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6)
    093        {
    094            return this.loadBlockGeneratorData(par1ArrayOfBiomeGenBase, par2, par3, par4, par5);
    095        }
    096
    097        /**
    098         * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks.
    099         * Strongly favors positive y positions.
    100         */
    101        public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
    102        {
    103            return par4List.contains(this.biomeGenerator) ? new ChunkPosition(par1 - par3 + par5Random.nextInt(par3 * 2 + 1), 0, par2 - par3 + par5Random.nextInt(par3 * 2 + 1)) : null;
    104        }
    105
    106        /**
    107         * checks given Chunk's Biomes against List of allowed ones
    108         */
    109        public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
    110        {
    111            return par4List.contains(this.biomeGenerator);
    112        }
    113    }