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