Пример #1
0
        /// <summary>
        /// Populates chunk with ores etc etc
        /// </summary>
        public void Populate(IChunkProvider par1IChunkProvider, int par2, int par3)
        {
            Random.SetSeed((int)WorldObj.GetSeed());
            long l  = (Random.Next() / 2L) * 2L + 1L;
            long l1 = (Random.Next() / 2L) * 2L + 1L;

            Random.SetSeed(par2 * (int)l + par3 * (int)l1 ^ (int)WorldObj.GetSeed());

            if (UseStructures)
            {
                VillageGen.GenerateStructuresInChunk(WorldObj, Random, par2, par3);
            }
        }
        ///<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;
        }