Exemplo n.º 1
0
        /// <summary>
        /// Finds a valid position within a range, that is once of the listed biomes.
        /// </summary>
        public virtual ChunkPosition FindBiomePosition(int par1, int par2, int par3, List <BiomeGenBase> par4List, Random par5Random)
        {
            int i  = par1 - par3 >> 2;
            int j  = par2 - par3 >> 2;
            int k  = par1 + par3 >> 2;
            int l  = par2 + par3 >> 2;
            int i1 = (k - i) + 1;
            int j1 = (l - j) + 1;

            int[]         ai            = GenBiomes.GetInts(i, j, i1, j1);
            ChunkPosition chunkposition = null;
            int           k1            = 0;

            for (int l1 = 0; l1 < ai.Length; l1++)
            {
                int          i2           = i + l1 % i1 << 2;
                int          j2           = j + l1 / i1 << 2;
                BiomeGenBase biomegenbase = BiomeGenBase.BiomeList[ai[l1]];

                if (par4List.Contains(biomegenbase) && (chunkposition == null || par5Random.Next(k1 + 1) == 0))
                {
                    chunkposition = new ChunkPosition(i2, 0, j2);
                    k1++;
                }
            }

            return(chunkposition);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
        /// don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
        /// </summary>
        public virtual BiomeGenBase[] GetBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, bool par6)
        {
            IntCache.ResetIntCache();

            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.Length < par4 * par5)
            {
                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
            }

            if (par6 && par4 == 16 && par5 == 16 && (par2 & 0xf) == 0 && (par3 & 0xf) == 0)
            {
                BiomeGenBase[] abiomegenbase = BiomeCache.GetCachedBiomes(par2, par3);
                Array.Copy(abiomegenbase, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
                return(par1ArrayOfBiomeGenBase);
            }

            int[] ai = BiomeIndexLayer.GetInts(par2, par3, par4, par5);

            for (int i = 0; i < par4 * par5; i++)
            {
                par1ArrayOfBiomeGenBase[i] = BiomeGenBase.BiomeList[ai[i]];
            }

            return(par1ArrayOfBiomeGenBase);
        }
Exemplo n.º 3
0
        protected override bool CanSpawnStructureAtCoords(int par1, int par2)
        {
            if (!RanBiomeCheck)
            {
                Random random = new Random();
                random.SetSeed((int)WorldObj.GetSeed());
                double d = random.NextDouble() * Math.PI * 2D;

                for (int k = 0; k < StructureCoords.Length; k++)
                {
                    double d1 = (1.25D + random.NextDouble()) * 32D;
                    int    l  = (int)Math.Round(Math.Cos(d) * d1);
                    int    i1 = (int)Math.Round(Math.Sin(d) * d1);
                    List <BiomeGenBase> arraylist     = new List <BiomeGenBase>();
                    BiomeGenBase[]      abiomegenbase = AllowedBiomeGenBases;
                    int j1 = abiomegenbase.Length;

                    for (int k1 = 0; k1 < j1; k1++)
                    {
                        BiomeGenBase biomegenbase = abiomegenbase[k1];
                        arraylist.Add(biomegenbase);
                    }

                    ChunkPosition chunkposition = WorldObj.GetWorldChunkManager().FindBiomePosition((l << 4) + 8, (i1 << 4) + 8, 112, arraylist, random);

                    if (chunkposition != null)
                    {
                        l  = chunkposition.x >> 4;
                        i1 = chunkposition.z >> 4;
                    }
                    else
                    {
                        Console.WriteLine((new StringBuilder()).Append("Placed stronghold in INVALID biome at (").Append(l).Append(", ").Append(i1).Append(")").ToString());
                    }

                    StructureCoords[k] = new ChunkCoordIntPair(l, i1);
                    d += (Math.PI * 2D) / (double)StructureCoords.Length;
                }

                RanBiomeCheck = true;
            }

            ChunkCoordIntPair[] achunkcoordintpair = StructureCoords;
            int i = achunkcoordintpair.Length;

            for (int j = 0; j < i; j++)
            {
                ChunkCoordIntPair chunkcoordintpair = achunkcoordintpair[j];

                if (par1 == chunkcoordintpair.ChunkXPos && par2 == chunkcoordintpair.ChunkZPos)
                {
                    Console.WriteLine((new StringBuilder()).Append(par1).Append(", ").Append(par2).ToString());
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
        /// WorldChunkManager Args: oldBiomeList, x, z, width, depth
        /// </summary>
        public override BiomeGenBase[] LoadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
        {
            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.Length < par4 * par5)
            {
                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
            }

            JavaHelper.FillArray(par1ArrayOfBiomeGenBase, 0, par4 * par5, BiomeGenerator);
            return(par1ArrayOfBiomeGenBase);
        }
Exemplo n.º 5
0
        ///<summary>
        /// Populates chunk with ores etc etc
        ///</summary>
        public void Populate(IChunkProvider par1IChunkProvider, int par2, int par3)
        {
            BlockSand.FallInstantly = true;
            int          i            = par2 * 16;
            int          j            = par3 * 16;
            BiomeGenBase biomegenbase = endWorld.GetBiomeGenForCoords(i + 16, j + 16);

            biomegenbase.Decorate(endWorld, endWorld.Rand, i, j);
            BlockSand.FallInstantly = false;
        }
        ///<summary>
        /// Returns a list of creatures of the specified type that can spawn at the given location.
        ///</summary>
        public List <SpawnListEntry> GetPossibleCreatures(CreatureType par1EnumCreatureType, int par2, int par3, int par4)
        {
            BiomeGenBase biomegenbase = worldObj.GetBiomeGenForCoords(par2, par4);

            if (biomegenbase == null)
            {
                return(null);
            }
            else
            {
                return(biomegenbase.GetSpawnableList(par1EnumCreatureType));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Ticks the block if it's been scheduled
        /// </summary>
        public override void UpdateTick(World par1World, int par2, int par3, int par4, Random par5Random)
        {
            int i = par1World.GetBlockMetadata(par2, par3, par4);

            if (i < 3)
            {
                BiomeGenBase biomegenbase = par1World.GetBiomeGenForCoords(par2, par4);

                if ((biomegenbase is BiomeGenHell) && par5Random.Next(10) == 0)
                {
                    i++;
                    par1World.SetBlockMetadataWithNotify(par2, par3, par4, i);
                }
            }

            base.UpdateTick(par1World, par2, par3, par4, par5Random);
        }
Exemplo n.º 8
0
        ///<summary>
        /// Returns a list of creatures of the specified type that can spawn at the given location.
        ///</summary>
        public List <SpawnListEntry> GetPossibleCreatures(CreatureType par1EnumCreatureType, int par2, int par3, int par4)
        {
            if (par1EnumCreatureType == CreatureType.Monster && GenNetherBridge.Func_40483_a(par2, par3, par4))
            {
                return(GenNetherBridge.GetSpawnList());
            }

            BiomeGenBase biomegenbase = worldObj.GetBiomeGenForCoords(par2, par4);

            if (biomegenbase == null)
            {
                return(null);
            }
            else
            {
                return(biomegenbase.GetSpawnableList(par1EnumCreatureType));
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns an array of biomes for the location input.
        /// </summary>
        public virtual BiomeGenBase[] GetBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
        {
            IntCache.ResetIntCache();

            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.Length < par4 * par5)
            {
                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
            }

            int[] ai = GenBiomes.GetInts(par2, par3, par4, par5);

            for (int i = 0; i < par4 * par5; i++)
            {
                par1ArrayOfBiomeGenBase[i] = BiomeGenBase.BiomeList[ai[i]];
            }

            return(par1ArrayOfBiomeGenBase);
        }
Exemplo n.º 10
0
        public virtual BiomeGenBase Func_48490_a(int par1, int par2, WorldChunkManager par3WorldChunkManager)
        {
            int i = blockBiomeArray[par2 << 4 | par1] & 0xff;

            if (i == 255)
            {
                BiomeGenBase biomegenbase = par3WorldChunkManager.GetBiomeGenAt((XPosition << 4) + par1, (ZPosition << 4) + par2);
                i = biomegenbase.BiomeID;
                blockBiomeArray[par2 << 4 | par1] = (byte)(i & 0xff);
            }

            if (BiomeGenBase.BiomeList[i] == null)
            {
                return(BiomeGenBase.Plains);
            }
            else
            {
                return(BiomeGenBase.BiomeList[i]);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// checks given Chunk's Biomes against List of allowed ones
        /// </summary>
        public virtual bool AreBiomesViable(int par1, int par2, int par3, List <BiomeGenBase> par4List)
        {
            int i  = par1 - par3 >> 2;
            int j  = par2 - par3 >> 2;
            int k  = par1 + par3 >> 2;
            int l  = par2 + par3 >> 2;
            int i1 = (k - i) + 1;
            int j1 = (l - j) + 1;

            int[] ai = GenBiomes.GetInts(i, j, i1, j1);

            for (int k1 = 0; k1 < i1 * j1; k1++)
            {
                BiomeGenBase biomegenbase = BiomeGenBase.BiomeList[ai[k1]];

                if (!par4List.Contains(biomegenbase))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 12
0
 public BiomeDecorator(BiomeGenBase par1BiomeGenBase)
 {
     ClayGen              = new WorldGenClay(4);
     SandGen              = new WorldGenSand(7, Block.Sand.BlockID);
     GravelAsSandGen      = new WorldGenSand(6, Block.Gravel.BlockID);
     DirtGen              = new WorldGenMinable(Block.Dirt.BlockID, 32);
     GravelGen            = new WorldGenMinable(Block.Gravel.BlockID, 32);
     CoalGen              = new WorldGenMinable(Block.OreCoal.BlockID, 16);
     IronGen              = new WorldGenMinable(Block.OreIron.BlockID, 8);
     GoldGen              = new WorldGenMinable(Block.OreGold.BlockID, 8);
     RedstoneGen          = new WorldGenMinable(Block.OreRedstone.BlockID, 7);
     DiamondGen           = new WorldGenMinable(Block.OreDiamond.BlockID, 7);
     LapisGen             = new WorldGenMinable(Block.OreLapis.BlockID, 6);
     PlantYellowGen       = new WorldGenFlowers(Block.PlantYellow.BlockID);
     PlantRedGen          = new WorldGenFlowers(Block.PlantRed.BlockID);
     MushroomBrownGen     = new WorldGenFlowers(Block.MushroomBrown.BlockID);
     MushroomRedGen       = new WorldGenFlowers(Block.MushroomRed.BlockID);
     BigMushroomGen       = new WorldGenBigMushroom();
     ReedGen              = new WorldGenReed();
     CactusGen            = new WorldGenCactus();
     WaterlilyGen         = new WorldGenWaterlily();
     WaterlilyPerChunk    = 0;
     TreesPerChunk        = 0;
     FlowersPerChunk      = 2;
     GrassPerChunk        = 1;
     DeadBushPerChunk     = 0;
     MushroomsPerChunk    = 0;
     ReedsPerChunk        = 0;
     CactiPerChunk        = 0;
     SandPerChunk         = 1;
     SandPerChunk2        = 3;
     ClayPerChunk         = 1;
     BigMushroomsPerChunk = 0;
     GenerateLakes        = true;
     Biome = par1BiomeGenBase;
 }
        ///<summary>
        /// Populates chunk with ores etc etc
        ///</summary>
        public void Populate(IChunkProvider par1IChunkProvider, int par2, int par3)
        {
            BlockSand.FallInstantly = true;
            int          i            = par2 * 16;
            int          j            = par3 * 16;
            BiomeGenBase biomegenbase = worldObj.GetBiomeGenForCoords(i + 16, j + 16);

            rand.SetSeed((int)worldObj.GetSeed());
            long l  = (rand.Next() / 2L) * 2L + 1L;
            long l1 = (rand.Next() / 2L) * 2L + 1L;

            rand.SetSeed(par2 * (int)l + par3 * (int)l1 ^ (int)worldObj.GetSeed());
            bool flag = false;

            if (mapFeaturesEnabled)
            {
                mineshaftGenerator.GenerateStructuresInChunk(worldObj, rand, par2, par3);
                flag = villageGenerator.GenerateStructuresInChunk(worldObj, rand, par2, par3);
                strongholdGenerator.GenerateStructuresInChunk(worldObj, rand, par2, par3);
            }

            if (!flag && rand.Next(4) == 0)
            {
                int k  = i + rand.Next(16) + 8;
                int i2 = rand.Next(128);
                int i3 = j + rand.Next(16) + 8;
                (new WorldGenLakes(Block.WaterStill.BlockID)).Generate(worldObj, rand, k, i2, i3);
            }

            if (!flag && rand.Next(8) == 0)
            {
                int i1 = i + rand.Next(16) + 8;
                int j2 = rand.Next(rand.Next(120) + 8);
                int j3 = j + rand.Next(16) + 8;

                if (j2 < 63 || rand.Next(10) == 0)
                {
                    (new WorldGenLakes(Block.LavaStill.BlockID)).Generate(worldObj, rand, i1, j2, j3);
                }
            }

            for (int j1 = 0; j1 < 8; j1++)
            {
                int k2 = i + rand.Next(16) + 8;
                int k3 = rand.Next(128);
                int i4 = j + rand.Next(16) + 8;

                if (!(new WorldGenDungeons()).Generate(worldObj, rand, k2, k3, i4))
                {
                    ;
                }
            }

            biomegenbase.Decorate(worldObj, rand, i, j);
            SpawnerAnimals.PerformWorldGenSpawning(worldObj, biomegenbase, i + 8, j + 8, 16, 16, rand);
            i += 8;
            j += 8;

            for (int k1 = 0; k1 < 16; k1++)
            {
                for (int l2 = 0; l2 < 16; l2++)
                {
                    int l3 = worldObj.GetPrecipitationHeight(i + k1, j + l2);

                    if (worldObj.IsBlockHydratedDirectly(k1 + i, l3 - 1, l2 + j))
                    {
                        worldObj.SetBlockWithNotify(k1 + i, l3 - 1, l2 + j, Block.Ice.BlockID);
                    }

                    if (worldObj.CanSnowAt(k1 + i, l3, l2 + j))
                    {
                        worldObj.SetBlockWithNotify(k1 + i, l3, l2 + j, Block.Snow.BlockID);
                    }
                }
            }

            BlockSand.FallInstantly = false;
        }
        ///<summary>
        /// generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
        /// size.
        ///</summary>
        private double[] InitializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
        {
            if (par1ArrayOfDouble == null)
            {
                par1ArrayOfDouble = new double[par5 * par6 * par7];
            }

            if (Field_35388_l == null)
            {
                Field_35388_l = new float[25];

                for (int i = -2; i <= 2; i++)
                {
                    for (int j = -2; j <= 2; j++)
                    {
                        float f = 10F / MathHelper2.Sqrt_float((float)(i * i + j * j) + 0.2F);
                        Field_35388_l[i + 2 + (j + 2) * 5] = f;
                    }
                }
            }

            double d  = 684.41200000000003D;
            double d1 = 684.41200000000003D;

            Noise5 = NoiseGen5.GenerateNoiseOctaves(Noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
            Noise6 = NoiseGen6.GenerateNoiseOctaves(Noise6, par2, par4, par5, par7, 200D, 200D, 0.5D);
            Noise3 = noiseGen3.GenerateNoiseOctaves(Noise3, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D);
            Noise1 = noiseGen1.GenerateNoiseOctaves(Noise1, par2, par3, par4, par5, par6, par7, d, d1, d);
            Noise2 = noiseGen2.GenerateNoiseOctaves(Noise2, par2, par3, par4, par5, par6, par7, d, d1, d);
            par2   = par4 = 0;
            int k = 0;
            int l = 0;

            for (int i1 = 0; i1 < par5; i1++)
            {
                for (int j1 = 0; j1 < par7; j1++)
                {
                    float        f1           = 0.0F;
                    float        f2           = 0.0F;
                    float        f3           = 0.0F;
                    byte         byte0        = 2;
                    BiomeGenBase biomegenbase = biomesForGeneration[i1 + 2 + (j1 + 2) * (par5 + 5)];

                    for (int k1 = -byte0; k1 <= byte0; k1++)
                    {
                        for (int l1 = -byte0; l1 <= byte0; l1++)
                        {
                            BiomeGenBase biomegenbase1 = biomesForGeneration[i1 + k1 + 2 + (j1 + l1 + 2) * (par5 + 5)];
                            float        f4            = Field_35388_l[k1 + 2 + (l1 + 2) * 5] / (biomegenbase1.MinHeight + 2.0F);

                            if (biomegenbase1.MinHeight > biomegenbase.MinHeight)
                            {
                                f4 /= 2.0F;
                            }

                            f1 += biomegenbase1.MaxHeight * f4;
                            f2 += biomegenbase1.MinHeight * f4;
                            f3 += f4;
                        }
                    }

                    f1 /= f3;
                    f2 /= f3;
                    f1  = f1 * 0.9F + 0.1F;
                    f2  = (f2 * 4F - 1.0F) / 8F;
                    double d2 = Noise6[l] / 8000D;

                    if (d2 < 0.0F)
                    {
                        d2 = -d2 * 0.29999999999999999D;
                    }

                    d2 = d2 * 3D - 2D;

                    if (d2 < 0.0F)
                    {
                        d2 /= 2D;

                        if (d2 < -1D)
                        {
                            d2 = -1D;
                        }

                        d2 /= 1.3999999999999999D;
                        d2 /= 2D;
                    }
                    else
                    {
                        if (d2 > 1.0D)
                        {
                            d2 = 1.0D;
                        }

                        d2 /= 8D;
                    }

                    l++;

                    for (int i2 = 0; i2 < par6; i2++)
                    {
                        double d3 = f2;
                        double d4 = f1;
                        d3 += d2 * 0.20000000000000001D;
                        d3  = (d3 * (double)par6) / 16D;
                        double d5 = (double)par6 / 2D + d3 * 4D;
                        double d6 = 0.0F;
                        double d7 = (((double)i2 - d5) * 12D * 128D) / 128D / d4;

                        if (d7 < 0.0F)
                        {
                            d7 *= 4D;
                        }

                        double d8  = Noise1[k] / 512D;
                        double d9  = Noise2[k] / 512D;
                        double d10 = (Noise3[k] / 10D + 1.0D) / 2D;

                        if (d10 < 0.0F)
                        {
                            d6 = d8;
                        }
                        else if (d10 > 1.0D)
                        {
                            d6 = d9;
                        }
                        else
                        {
                            d6 = d8 + (d9 - d8) * d10;
                        }

                        d6 -= d7;

                        if (i2 > par6 - 4)
                        {
                            double d11 = (float)(i2 - (par6 - 4)) / 3F;
                            d6 = d6 * (1.0D - d11) + -10D * d11;
                        }

                        par1ArrayOfDouble[k] = d6;
                        k++;
                    }
                }
            }

            return(par1ArrayOfDouble);
        }
        ///<summary>
        /// Replaces the stone that was placed in with blocks that match the biome
        ///</summary>
        public void ReplaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
        {
            byte   byte0 = 63;
            double d     = 0.03125D;

            stoneNoise = noiseGen4.GenerateNoiseOctaves(stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d * 2D, d * 2D, d * 2D);

            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[j + i * 16];
                    float        f            = biomegenbase.GetFloatTemperature();
                    int          k            = (int)(stoneNoise[i + j * 16] / 3D + 3D + rand.NextDouble() * 0.25D);
                    int          l            = -1;
                    byte         byte1        = biomegenbase.TopBlock;
                    byte         byte2        = biomegenbase.FillerBlock;

                    for (int i1 = 127; i1 >= 0; i1--)
                    {
                        int j1 = (j * 16 + i) * 128 + i1;

                        if (i1 <= 0 + rand.Next(5))
                        {
                            par3ArrayOfByte[j1] = (byte)Block.Bedrock.BlockID;
                            continue;
                        }

                        byte byte3 = par3ArrayOfByte[j1];

                        if (byte3 == 0)
                        {
                            l = -1;
                            continue;
                        }

                        if (byte3 != Block.Stone.BlockID)
                        {
                            continue;
                        }

                        if (l == -1)
                        {
                            if (k <= 0)
                            {
                                byte1 = 0;
                                byte2 = (byte)Block.Stone.BlockID;
                            }
                            else if (i1 >= byte0 - 4 && i1 <= byte0 + 1)
                            {
                                byte1 = biomegenbase.TopBlock;
                                byte2 = biomegenbase.FillerBlock;
                            }

                            if (i1 < byte0 && byte1 == 0)
                            {
                                if (f < 0.15F)
                                {
                                    byte1 = (byte)Block.Ice.BlockID;
                                }
                                else
                                {
                                    byte1 = (byte)Block.WaterStill.BlockID;
                                }
                            }

                            l = k;

                            if (i1 >= byte0 - 1)
                            {
                                par3ArrayOfByte[j1] = byte1;
                            }
                            else
                            {
                                par3ArrayOfByte[j1] = byte2;
                            }

                            continue;
                        }

                        if (l <= 0)
                        {
                            continue;
                        }

                        l--;
                        par3ArrayOfByte[j1] = byte2;

                        if (l == 0 && byte2 == Block.Sand.BlockID)
                        {
                            l     = rand.Next(4);
                            byte2 = (byte)Block.SandStone.BlockID;
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Called during chunk generation to spawn initial creatures.
        /// </summary>
        public static void PerformWorldGenSpawning(World par0World, BiomeGenBase par1BiomeGenBase, int par2, int par3, int par4, int par5, Random par6Random)
        {
            List <SpawnListEntry> list = par1BiomeGenBase.GetSpawnableList(CreatureType.Creature);

            if (list.Count == 0)
            {
                return;
            }

            while (par6Random.NextDouble() < par1BiomeGenBase.GetSpawningChance())
            {
                SpawnListEntry spawnlistentry = (SpawnListEntry)WeightedRandom.GetRandomItem(par0World.Rand, list);
                int            i  = spawnlistentry.MinGroupCount + par6Random.Next((1 + spawnlistentry.MaxGroupCount) - spawnlistentry.MinGroupCount);
                int            j  = par2 + par6Random.Next(par4);
                int            k  = par3 + par6Random.Next(par5);
                int            l  = j;
                int            i1 = k;
                int            j1 = 0;

                while (j1 < i)
                {
                    bool flag = false;

                    for (int k1 = 0; !flag && k1 < 4; k1++)
                    {
                        int l1 = par0World.GetTopSolidOrLiquidBlock(j, k);

                        if (CanCreatureTypeSpawnAtLocation(CreatureType.Creature, par0World, j, l1, k))
                        {
                            float        f  = (float)j + 0.5F;
                            float        f1 = l1;
                            float        f2 = (float)k + 0.5F;
                            EntityLiving entityliving;

                            try
                            {
                                entityliving = (EntityLiving)Activator.CreateInstance(spawnlistentry.EntityClass, new object[] { par0World });
                            }
                            catch (Exception exception)
                            {
                                Console.WriteLine(exception.ToString());
                                Console.Write(exception.StackTrace);
                                continue;
                            }

                            entityliving.SetLocationAndAngles(f, f1, f2, (float)par6Random.NextDouble() * 360F, 0.0F);
                            par0World.SpawnEntityInWorld(entityliving);
                            CreatureSpecificInit(entityliving, par0World, f, f1, f2);
                            flag = true;
                        }

                        j += par6Random.Next(5) - par6Random.Next(5);

                        for (k += par6Random.Next(5) - par6Random.Next(5); j < par2 || j >= par2 + par4 || k < par3 || k >= par3 + par4; k = (i1 + par6Random.Next(5)) - par6Random.Next(5))
                        {
                            j = (l + par6Random.Next(5)) - par6Random.Next(5);
                        }
                    }

                    j1++;
                }
            }
        }
        public override bool Generate(World par1World, Random par2Random, int par3, int par4, int par5)
        {
            par3 -= 8;

            for (par5 -= 8; par4 > 5 && par1World.IsAirBlock(par3, par4, par5); par4--)
            {
            }

            if (par4 <= 4)
            {
                return(false);
            }

            par4 -= 4;
            bool[] aflag = new bool[2048];
            int    i     = par2Random.Next(4) + 4;

            for (int j = 0; j < i; j++)
            {
                double d  = par2Random.NextDouble() * 6D + 3D;
                double d1 = par2Random.NextDouble() * 4D + 2D;
                double d2 = par2Random.NextDouble() * 6D + 3D;
                double d3 = par2Random.NextDouble() * (16D - d - 2D) + 1.0D + d / 2D;
                double d4 = par2Random.NextDouble() * (8D - d1 - 4D) + 2D + d1 / 2D;
                double d5 = par2Random.NextDouble() * (16D - d2 - 2D) + 1.0D + d2 / 2D;

                for (int i4 = 1; i4 < 15; i4++)
                {
                    for (int j4 = 1; j4 < 15; j4++)
                    {
                        for (int k4 = 1; k4 < 7; k4++)
                        {
                            double d6 = ((double)i4 - d3) / (d / 2D);
                            double d7 = ((double)k4 - d4) / (d1 / 2D);
                            double d8 = ((double)j4 - d5) / (d2 / 2D);
                            double d9 = d6 * d6 + d7 * d7 + d8 * d8;

                            if (d9 < 1.0D)
                            {
                                aflag[(i4 * 16 + j4) * 8 + k4] = true;
                            }
                        }
                    }
                }
            }

            for (int k = 0; k < 16; k++)
            {
                for (int l1 = 0; l1 < 16; l1++)
                {
                    for (int i3 = 0; i3 < 8; i3++)
                    {
                        bool flag = !aflag[(k * 16 + l1) * 8 + i3] && (k < 15 && aflag[((k + 1) * 16 + l1) * 8 + i3] || k > 0 && aflag[((k - 1) * 16 + l1) * 8 + i3] || l1 < 15 && aflag[(k * 16 + (l1 + 1)) * 8 + i3] || l1 > 0 && aflag[(k * 16 + (l1 - 1)) * 8 + i3] || i3 < 7 && aflag[(k * 16 + l1) * 8 + (i3 + 1)] || i3 > 0 && aflag[(k * 16 + l1) * 8 + (i3 - 1)]);

                        if (!flag)
                        {
                            continue;
                        }

                        Material material = par1World.GetBlockMaterial(par3 + k, par4 + i3, par5 + l1);

                        if (i3 >= 4 && material.IsLiquid())
                        {
                            return(false);
                        }

                        if (i3 < 4 && !material.IsSolid() && par1World.GetBlockId(par3 + k, par4 + i3, par5 + l1) != BlockIndex)
                        {
                            return(false);
                        }
                    }
                }
            }

            for (int l = 0; l < 16; l++)
            {
                for (int i2 = 0; i2 < 16; i2++)
                {
                    for (int j3 = 0; j3 < 8; j3++)
                    {
                        if (aflag[(l * 16 + i2) * 8 + j3])
                        {
                            par1World.SetBlock(par3 + l, par4 + j3, par5 + i2, j3 < 4 ? BlockIndex : 0);
                        }
                    }
                }
            }

            for (int i1 = 0; i1 < 16; i1++)
            {
                for (int j2 = 0; j2 < 16; j2++)
                {
                    for (int k3 = 4; k3 < 8; k3++)
                    {
                        if (!aflag[(i1 * 16 + j2) * 8 + k3] || par1World.GetBlockId(par3 + i1, (par4 + k3) - 1, par5 + j2) != Block.Dirt.BlockID || par1World.GetSavedLightValue(SkyBlock.Sky, par3 + i1, par4 + k3, par5 + j2) <= 0)
                        {
                            continue;
                        }

                        BiomeGenBase biomegenbase = par1World.GetBiomeGenForCoords(par3 + i1, par5 + j2);

                        if (biomegenbase.TopBlock == Block.Mycelium.BlockID)
                        {
                            par1World.SetBlock(par3 + i1, (par4 + k3) - 1, par5 + j2, Block.Mycelium.BlockID);
                        }
                        else
                        {
                            par1World.SetBlock(par3 + i1, (par4 + k3) - 1, par5 + j2, Block.Grass.BlockID);
                        }
                    }
                }
            }

            if (Block.BlocksList[BlockIndex].BlockMaterial == Material.Lava)
            {
                for (int j1 = 0; j1 < 16; j1++)
                {
                    for (int k2 = 0; k2 < 16; k2++)
                    {
                        for (int l3 = 0; l3 < 8; l3++)
                        {
                            bool flag1 = !aflag[(j1 * 16 + k2) * 8 + l3] && (j1 < 15 && aflag[((j1 + 1) * 16 + k2) * 8 + l3] || j1 > 0 && aflag[((j1 - 1) * 16 + k2) * 8 + l3] || k2 < 15 && aflag[(j1 * 16 + (k2 + 1)) * 8 + l3] || k2 > 0 && aflag[(j1 * 16 + (k2 - 1)) * 8 + l3] || l3 < 7 && aflag[(j1 * 16 + k2) * 8 + (l3 + 1)] || l3 > 0 && aflag[(j1 * 16 + k2) * 8 + (l3 - 1)]);

                            if (flag1 && (l3 < 4 || par2Random.Next(2) != 0) && par1World.GetBlockMaterial(par3 + j1, par4 + l3, par5 + k2).IsSolid())
                            {
                                par1World.SetBlock(par3 + j1, par4 + l3, par5 + k2, Block.Stone.BlockID);
                            }
                        }
                    }
                }
            }

            if (Block.BlocksList[BlockIndex].BlockMaterial == Material.Water)
            {
                for (int k1 = 0; k1 < 16; k1++)
                {
                    for (int l2 = 0; l2 < 16; l2++)
                    {
                        sbyte byte0 = 4;

                        if (par1World.IsBlockHydratedDirectly(par3 + k1, par4 + byte0, par5 + l2))
                        {
                            par1World.SetBlock(par3 + k1, par4 + byte0, par5 + l2, Block.Ice.BlockID);
                        }
                    }
                }
            }

            return(true);
        }
 public WorldChunkManagerHell(BiomeGenBase par1BiomeGenBase, float par2, float par3)
 {
     BiomeGenerator  = par1BiomeGenBase;
     HellTemperature = par2;
     Rainfall        = par3;
 }