    001package net.minecraft.world;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.block.Block;
    006import net.minecraft.util.ChunkCoordinates;
    007import net.minecraft.util.MathHelper;
    008import net.minecraft.util.Vec3;
    009import net.minecraft.world.biome.BiomeGenBase;
    010import net.minecraft.world.biome.WorldChunkManagerHell;
    011import net.minecraft.world.chunk.IChunkProvider;
    012import net.minecraft.world.gen.ChunkProviderEnd;
    013
    014public class WorldProviderEnd extends WorldProvider
    015{
    016    /**
    017     * creates a new world chunk manager for WorldProvider
    018     */
    019    public void registerWorldChunkManager()
    020    {
    021        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.5F, 0.0F);
    022        this.dimensionId = 1;
    023        this.hasNoSky = true;
    024    }
    025
    026    /**
    027     * Returns a new chunk provider which generates chunks for this world
    028     */
    029    public IChunkProvider createChunkGenerator()
    030    {
    031        return new ChunkProviderEnd(this.worldObj, this.worldObj.getSeed());
    032    }
    033
    034    /**
    035     * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
    036     */
    037    public float calculateCelestialAngle(long par1, float par3)
    038    {
    039        return 0.0F;
    040    }
    041
    042    @SideOnly(Side.CLIENT)
    043
    044    /**
    045     * Returns array with sunrise/sunset colors
    046     */
    047    public float[] calcSunriseSunsetColors(float par1, float par2)
    048    {
    049        return null;
    050    }
    051
    052    @SideOnly(Side.CLIENT)
    053
    054    /**
    055     * Return Vec3D with biome specific fog color
    056     */
    057    public Vec3 getFogColor(float par1, float par2)
    058    {
    059        int var3 = 10518688;
    060        float var4 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    061
    062        if (var4 < 0.0F)
    063        {
    064            var4 = 0.0F;
    065        }
    066
    067        if (var4 > 1.0F)
    068        {
    069            var4 = 1.0F;
    070        }
    071
    072        float var5 = (float)(var3 >> 16 & 255) / 255.0F;
    073        float var6 = (float)(var3 >> 8 & 255) / 255.0F;
    074        float var7 = (float)(var3 & 255) / 255.0F;
    075        var5 *= var4 * 0.0F + 0.15F;
    076        var6 *= var4 * 0.0F + 0.15F;
    077        var7 *= var4 * 0.0F + 0.15F;
    078        return this.worldObj.getWorldVec3Pool().getVecFromPool((double)var5, (double)var6, (double)var7);
    079    }
    080
    081    @SideOnly(Side.CLIENT)
    082    public boolean isSkyColored()
    083    {
    084        return false;
    085    }
    086
    087    /**
    088     * True if the player can respawn in this dimension (true = overworld, false = nether).
    089     */
    090    public boolean canRespawnHere()
    091    {
    092        return false;
    093    }
    094
    095    /**
    096     * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
    097     */
    098    public boolean isSurfaceWorld()
    099    {
    100        return false;
    101    }
    102
    103    @SideOnly(Side.CLIENT)
    104
    105    /**
    106     * the y level at which clouds are rendered.
    107     */
    108    public float getCloudHeight()
    109    {
    110        return 8.0F;
    111    }
    112
    113    /**
    114     * Will check if the x, z position specified is alright to be set as the map spawn point
    115     */
    116    public boolean canCoordinateBeSpawn(int par1, int par2)
    117    {
    118        int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
    119        return var3 == 0 ? false : Block.blocksList[var3].blockMaterial.blocksMovement();
    120    }
    121
    122    /**
    123     * Gets the hard-coded portal location to use when entering this dimension.
    124     */
    125    public ChunkCoordinates getEntrancePortalLocation()
    126    {
    127        return new ChunkCoordinates(100, 50, 0);
    128    }
    129
    130    public int getAverageGroundLevel()
    131    {
    132        return 50;
    133    }
    134
    135    @SideOnly(Side.CLIENT)
    136
    137    /**
    138     * Returns true if the given X,Z coordinate should show environmental fog.
    139     */
    140    public boolean doesXZShowFog(int par1, int par2)
    141    {
    142        return true;
    143    }
    144
    145    /**
    146     * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".
    147     */
    148    public String getDimensionName()
    149    {
    150        return "The End";
    151    }
    152}