public static void Generate(frmMace frmLogForm, BetaWorld worldDest, BetaChunkManager cmDest, BlockManager bmDest, int x, int z)
        {
            #region create a city name
            string strStart, strEnd;
            do
            {
                strStart  = RandomHelper.RandomFileLine(Path.Combine("Resources", City.CityNamePrefixFilename));
                strEnd    = RandomHelper.RandomFileLine(Path.Combine("Resources", City.CityNameSuffixFilename));
                City.Name = "City of " + strStart + strEnd;
            } while (GenerateWorld.lstCityNames.Contains(City.Name) ||
                     strStart.ToLower().Trim() == strEnd.ToLower().Trim() ||
                     (strStart + strEnd).Length > 14);
            GenerateWorld.lstCityNames.Add(City.Name);
            #endregion

            #region determine block sizes
            City.CityLength *= 16; // chunk length
            City.FarmLength  = City.HasFarms ? 32 : 8;
            City.MapLength   = City.CityLength + (City.FarmLength * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest);
            BlockHelper.SetupClass(bmDest);
            NoticeBoard.SetupClass();
            if (!SourceWorld.SetupClass(worldDest))
            {
                return;
            }
            #endregion

            #region determine random options
#pragma warning disable
            switch (City.WallMaterialID)
            {
            case BlockType.WOOD_PLANK:
            case BlockType.WOOD:
            case BlockType.LEAVES:
            case BlockType.VINES:
            case BlockType.WOOL:
            case BlockType.BOOKSHELF:
                switch (City.OutsideLightType)
                {
                case "Fire":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.OutsideLightType = "Torches";
                    break;
                }
                switch (City.MoatType)
                {
                case "Fire":
                case "Lava":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.MoatType = "Water";
                    break;
                }
                break;
            }
#pragma warning restore
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating the " + City.Name, false, false);
            frmLogForm.UpdateLog("City length in blocks: " + City.MapLength, true, true);
            frmLogForm.UpdateLog("City position in blocks: " + ((x + 30) * 16) + "," + ((z + 30) * 16), true, true);
            frmLogForm.UpdateLog("Theme: " + City.ThemeName, true, true);
            frmLogForm.UpdateLog("Creating underground terrain", true, false);
            Chunks.CreateInitialChunks(cmDest, frmLogForm);
            frmLogForm.UpdateProgress(0.35);

            Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint();

            if (City.HasWalls)
            {
                frmLogForm.UpdateLog("Creating walls", true, false);
                Walls.MakeWalls(worldDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.45);
            if (City.HasBuildings || City.HasPaths)
            {
                frmLogForm.UpdateLog("Creating paths", true, false);
                int[,] intArea = Paths.MakePaths(worldDest, bmDest);
                frmLogForm.UpdateProgress(0.50);
                if (City.HasBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings", true, false);
                    spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, frmLogForm);
                    frmLogForm.UpdateProgress(0.55);
                    if (City.HasMineshaft)
                    {
                        frmLogForm.UpdateLog("Creating mineshaft", true, false);
                        Mineshaft.MakeMineshaft(worldDest, bmDest, spMineshaftEntrance, frmLogForm);
                    }
                }
            }
            frmLogForm.UpdateProgress(0.60);

            if (City.HasMoat)
            {
                frmLogForm.UpdateLog("Creating moat", true, false);
                Moat.MakeMoat(frmLogForm);
            }
            frmLogForm.UpdateProgress(0.65);

            if (City.HasDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges", true, false);
                Drawbridge.MakeDrawbridges(bmDest);
            }
            frmLogForm.UpdateProgress(0.70);

            if (City.HasGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers", true, false);
                GuardTowers.MakeGuardTowers(bmDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.75);

            if (City.HasFarms)
            {
                frmLogForm.UpdateLog("Creating farms", true, false);
                Farms.MakeFarms(worldDest, bmDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.80);

            if (!City.HasValuableBlocks)
            {
                frmLogForm.UpdateLog("Replacing valuable blocks", true, true);
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest);
            }
            frmLogForm.UpdateProgress(0.90);
            frmLogForm.UpdateLog("Creating rail data", true, false);
            Chunks.PositionRails(worldDest, bmDest);
            frmLogForm.UpdateProgress(0.95);
            frmLogForm.UpdateLog("Creating position data", true, false);

            Chunks.MoveChunks(worldDest, cmDest, x, z);
            frmLogForm.UpdateProgress(1);
            #endregion
        }
        public static void Generate(frmMace frmLogForm, string strUserCityName,
                                    bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                                    bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeBuildings,
                                    bool booIncludePaths, bool booIncludeMineshaft, bool booIncludeItemsInChests,
                                    bool booIncludeValuableBlocks, bool booIncludeGhostdancerSpawners,
                                    string strCitySize, string strMoatType, string strCityEmblem,
                                    string strOutsideLights, string strTowerAddition, string strWallMaterial,
                                    string strCitySeed, string strWorldSeed, bool booExportSchematic)
        {
            #region seed the random number generators
            int    intCitySeed, intWorldSeed;
            Random randSeeds = new Random();
            if (strCitySeed.Length == 0)
            {
                intCitySeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random city seed: " + intCitySeed);
            }
            else
            {
                intCitySeed = JavaStringHashCode(strCitySeed);
                frmLogForm.UpdateLog("Random city seed: " + strCitySeed);
            }
            if (strWorldSeed.Length == 0)
            {
                intWorldSeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random world seed: " + intWorldSeed);
            }
            else
            {
                intWorldSeed = JavaStringHashCode(strWorldSeed);
                frmLogForm.UpdateLog("Random world seed: " + strWorldSeed);
            }
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region create minecraft world directory from a random unused city name
            string strFolder = String.Empty, strCityName = String.Empty;

            strUserCityName = SafeFilename(strUserCityName);
            if (strUserCityName.ToLower().Trim().Length == 0)
            {
                strUserCityName = "random";
            }

            if (strUserCityName.ToLower().Trim() != "random")
            {
                if (Directory.Exists(Utils.GetMinecraftSavesDirectory(strUserCityName)))
                {
                    if (MessageBox.Show("A world called \"" + strUserCityName + "\" already exists. " +
                                        "Would you like to use a random name instead?", "World already exists",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        frmLogForm.UpdateLog("Cancelled, because a world with this name already exists.");
                        return;
                    }
                }
                else
                {
                    strCityName = strUserCityName;
                    strFolder   = Utils.GetMinecraftSavesDirectory(strCityName);
                }
            }
            if (strCityName.Length == 0)
            {
                string strStart, strEnd;
                do
                {
                    strStart    = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityAdj.txt"));
                    strEnd      = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityNoun.txt"));
                    strCityName = "City of " + strStart + strEnd;
                    strFolder   = Utils.GetMinecraftSavesDirectory(strCityName);
                } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder) || (strStart + strEnd).Length > 14);
            }
            Directory.CreateDirectory(strFolder);
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region get handles to world, chunk manager and block manager
            BetaWorld        worldDest = BetaWorld.Create(@strFolder);
            BetaChunkManager cmDest    = worldDest.GetChunkManager();
            BlockManager     bmDest    = worldDest.GetBlockManager();
            bmDest.AutoLight = false;
            #endregion

            #region determine block sizes
            // first we set the city size by chunks
            int intCitySize = 12;
            switch (strCitySize)
            {
            case "Random":
                intCitySize = RandomHelper.Next(8, 16);
                break;

            case "Very small":
                intCitySize = 5;
                break;

            case "Small":
                intCitySize = 8;
                break;

            case "Medium":
                intCitySize = 12;
                break;

            case "Large":
                intCitySize = 16;
                break;

            case "Very large":
                intCitySize = 25;
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // then we multiply by 16, because that's the x and z of a chunk
            intCitySize *= 16;
            int intFarmLength = booIncludeFarms ? 32 : 8;
            int intMapLength  = intCitySize + (intFarmLength * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest, intMapLength);
            BlockHelper.SetupClass(bmDest, intMapLength);
            if (!SourceWorld.SetupClass(worldDest, booIncludeItemsInChests, booIncludeGhostdancerSpawners))
            {
                return;
            }
            NoticeBoard.SetupClass(intCitySeed, intWorldSeed);
            #endregion

            #region determine random options
            // ensure selected options take priority, but don't set things on fire
            if (strTowerAddition == "Random")
            {
                strTowerAddition = RandomHelper.RandomString("Fire beacon", "Flag");
            }
            if (strWallMaterial.StartsWith("Wood"))
            {
                if (strMoatType == "Lava" || strMoatType == "Fire" || strMoatType == "Random")
                {
                    strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                }
                strOutsideLights = "Torches";
            }
            if (strWallMaterial == "Random")
            {
                if (strMoatType == "Lava" || strMoatType == "Fire" || strOutsideLights == "Fire")
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone", "Stone");
                }
                else
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone",
                                                                "Stone", "Wood Planks");
                    if (strWallMaterial.StartsWith("Wood"))
                    {
                        if (strMoatType == "Random")
                        {
                            strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                        }
                        strOutsideLights = "Torches";
                    }
                }
            }
            if (strOutsideLights == "Random")
            {
                strOutsideLights = RandomHelper.RandomString("Fire", "Torches");
            }
            if (strMoatType == "Random")
            {
                int intRand = RandomHelper.Next(100);
                if (intRand >= 90)
                {
                    strMoatType = "Drop to Bedrock";
                }
                else if (intRand >= 80)
                {
                    strMoatType = "Cactus";
                }
                else if (intRand >= 50)
                {
                    strMoatType = "Lava";
                }
                else if (intRand >= 40)
                {
                    strMoatType = "Fire";
                }
                else
                {
                    strMoatType = "Water";
                }
            }

            int intWallMaterial = BlockType.STONE;
            switch (strWallMaterial)
            {
            case "Brick":
                intWallMaterial = BlockType.BRICK_BLOCK;
                break;

            case "Cobblestone":
                intWallMaterial = BlockType.COBBLESTONE;
                break;

            case "Sandstone":
                intWallMaterial = BlockType.SANDSTONE;
                break;

            case "Stone":
                intWallMaterial = BlockType.STONE;
                break;

            case "Wood Planks":
                intWallMaterial = BlockType.WOOD_PLANK;
                break;

            case "Wood Logs":
                intWallMaterial = BlockType.WOOD;
                break;

            case "Bedrock":
                intWallMaterial = BlockType.BEDROCK;
                break;

            case "Mossy Cobblestone":
                intWallMaterial = BlockType.MOSS_STONE;
                break;

            case "Netherrack":
                intWallMaterial = BlockType.NETHERRACK;
                break;

            case "Glass":
                intWallMaterial = BlockType.GLASS;
                break;

            case "Ice":
                intWallMaterial = BlockType.ICE;
                break;

            case "Snow":
                intWallMaterial = BlockType.SNOW_BLOCK;
                break;

            case "Glowstone":
                intWallMaterial = BlockType.GLOWSTONE_BLOCK;
                break;

            case "Dirt":
                intWallMaterial = BlockType.DIRT;
                break;

            case "Obsidian":
                intWallMaterial = BlockType.OBSIDIAN;
                break;

            case "Jack-o-Lantern":
                intWallMaterial = BlockType.JACK_O_LANTERN;
                break;

            case "Soul sand":
                intWallMaterial = BlockType.SOUL_SAND;
                break;

            case "Gold":
                intWallMaterial = BlockType.GOLD_BLOCK;
                break;

            case "Diamond":
                intWallMaterial = BlockType.DIAMOND_BLOCK;
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating underground terrain");
            Chunks.CreateInitialChunks(cmDest, intMapLength / 16, frmLogForm);
            frmLogForm.UpdateProgress(25);

            Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint();

            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(worldDest, intFarmLength, intMapLength, strCityEmblem, strOutsideLights, intWallMaterial);
            }
            frmLogForm.UpdateProgress(34);
            if (booIncludeBuildings || booIncludePaths)
            {
                frmLogForm.UpdateLog("Creating paths");
                int[,] intArea = Paths.MakePaths(worldDest, bmDest, intFarmLength, intMapLength, strCitySize,
                                                 booIncludeMineshaft);
                frmLogForm.UpdateProgress(36);
                if (booIncludeBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings");
                    spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, intFarmLength, intMapLength, booIncludePaths);
                    frmLogForm.UpdateProgress(45);
                    if (booIncludeMineshaft)
                    {
                        frmLogForm.UpdateLog("Creating mineshaft");
                        Mineshaft.MakeMineshaft(worldDest, bmDest, intFarmLength, intMapLength, spMineshaftEntrance);
                    }
                }
            }
            frmLogForm.UpdateProgress(51);

            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmLength, intMapLength, strMoatType, booIncludeGuardTowers);
            }
            frmLogForm.UpdateProgress(52);

            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bmDest, intFarmLength, intMapLength, booIncludeMoat,
                                           booIncludeWalls, booIncludeItemsInChests, intWallMaterial, strMoatType, strCityName);
            }
            frmLogForm.UpdateProgress(53);

            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bmDest, intFarmLength, intMapLength, booIncludeWalls,
                                            strOutsideLights, strTowerAddition, booIncludeItemsInChests, intWallMaterial);
            }
            frmLogForm.UpdateProgress(54);

            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(worldDest, bmDest, intFarmLength, intMapLength);
            }
            frmLogForm.UpdateProgress(58);

            if (!booIncludeValuableBlocks)
            {
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest, intMapLength, intWallMaterial);
            }
            frmLogForm.UpdateProgress(60);
            Chunks.PositionRails(worldDest, bmDest, intMapLength);
            frmLogForm.UpdateProgress(62);
            #endregion

            #region world settings
            // spawn looking at one of the city entrances
            if (booIncludeFarms)
            {
                SpawnPoint spLevel = new SpawnPoint(7, 11, 13);
                worldDest.Level.Spawn = spLevel;
                worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength - (intFarmLength - 10));
            }
            else
            {
                worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength - (intFarmLength - 7));
            }
            // spawn in the middle of the city
//#if DEBUG
            //worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength / 2);
//#endif
            if (strWorldSeed.Length > 0)
            {
                worldDest.Level.RandomSeed = intWorldSeed;
            }

#if RELEASE
            worldDest.Level.Time = RandomHelper.Next(24000);

            if (RandomHelper.NextDouble() < 0.15)
            {
                worldDest.Level.IsRaining = true;
                // one-quarter to three-quarters of a day
                worldDest.Level.RainTime = RandomHelper.Next(6000, 18000);
                if (RandomHelper.NextDouble() < 0.25)
                {
                    worldDest.Level.IsThundering = true;
                    worldDest.Level.ThunderTime  = worldDest.Level.RainTime;
                }
            }
#endif
            #endregion

#if DEBUG
            MakeHelperChest(bmDest, worldDest.Level.Spawn.X + 2, worldDest.Level.Spawn.Y, worldDest.Level.Spawn.Z + 2);
#endif

            frmLogForm.UpdateLog("Creating lighting data");
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm, (int)Math.Pow(intMapLength / 16, 2));

            worldDest.Level.LevelName = strCityName;
            worldDest.Save();

            if (booExportSchematic)
            {
                frmLogForm.UpdateLog("Creating schematic");
                AlphaBlockCollection abcExport = new AlphaBlockCollection(intMapLength, 128, intMapLength);
                for (int x = 0; x < intMapLength; x++)
                {
                    for (int z = 0; z < intMapLength; z++)
                    {
                        for (int y = 0; y < 128; y++)
                        {
                            abcExport.SetBlock(x, y, z, bmDest.GetBlock(x, y, z));
                        }
                    }
                }
                Schematic CitySchematic = new Schematic(intMapLength, 128, intMapLength);
                CitySchematic.Blocks = abcExport;
                CitySchematic.Export(Utils.GetMinecraftSavesDirectory(strCityName) + "\\" + strCityName + ".schematic");
            }

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
Exemple #3
0
        public static void Generate(frmMace frmLogForm, BetaWorld worldDest, BetaChunkManager cmDest, BlockManager bmDest,
                                    int x, int z, bool booExportSchematics, string strUndergroundOres)
        {
            #region create a city name
            string strStart, strEnd;
            do
            {
                strStart  = RNG.RandomFileLine(Path.Combine("Resources", City.CityNamePrefixFilename));
                strEnd    = RNG.RandomFileLine(Path.Combine("Resources", City.CityNameSuffixFilename));
                City.Name = City.CityNamePrefix + strStart + strEnd;
            } while (GenerateWorld.lstCityNames.Contains(City.Name) ||
                     strStart.ToLower().Trim() == strEnd.ToLower().Trim() ||
                     (strStart + strEnd).Length > 14);
            GenerateWorld.lstCityNames.Add(City.Name);
            #endregion

            #region determine block sizes
            City.CityLength *= 16;
            City.FarmLength *= 16;
            City.EdgeLength  = 8;
            City.MapLength   = City.CityLength + (City.EdgeLength * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest);
            BlockHelper.SetupClass(bmDest);
            NoticeBoard.SetupClass();
            if (!SourceWorld.SetupClass(worldDest))
            {
                return;
            }
            #endregion

            #region determine random options
            switch (City.WallMaterialID)
            {
            case BlockType.WOOD_PLANK:
            case BlockType.WOOD:
            case BlockType.LEAVES:
            case BlockType.VINES:
            case BlockType.WOOL:
            case BlockType.BOOKSHELF:
                switch (City.OutsideLightType)
                {
                case "Fire":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.OutsideLightType = "Torches";
                    break;
                }
                switch (City.MoatType)
                {
                case "Fire":
                case "Lava":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.MoatType = "Water";
                    break;
                }
                break;
            }
            switch (City.PathType.ToLower().Trim())
            {
            case "stone_raised":
                City.PathBlockID              = BlockInfo.DoubleSlab.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 0;
                City.PathExtends              = 2;
                break;

            case "sandstone_raised":
                City.PathBlockID              = BlockInfo.Sandstone.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 1;
                City.PathExtends              = 2;
                break;

            case "woodplanks_raised":
                City.PathBlockID              = BlockInfo.WoodPlank.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 2;
                City.PathExtends              = 2;
                break;

            case "cobblestone_raised":
                City.PathBlockID              = BlockInfo.Cobblestone.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 3;
                City.PathExtends              = 2;
                break;

            case "brick_raised":
                City.PathBlockID              = BlockInfo.BrickBlock.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 4;
                City.PathExtends              = 2;
                break;

            case "stonebrick_raised":
                City.PathBlockID              = BlockInfo.StoneBrick.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = BlockInfo.Slab.ID;
                City.PathAlternativeBlockData = 5;
                City.PathExtends              = 2;
                break;

            case "stonebrick":
                City.PathBlockID              = BlockInfo.StoneBrick.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = 0;
                City.PathAlternativeBlockData = 0;
                City.PathExtends              = 1;
                break;

            case "sandstone":
                City.PathBlockID              = BlockInfo.Sandstone.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = 0;
                City.PathAlternativeBlockData = 0;
                City.PathExtends              = 1;
                break;

            case "stone":
                City.PathBlockID              = BlockInfo.Stone.ID;
                City.PathBlockData            = 0;
                City.PathAlternativeBlockID   = 0;
                City.PathAlternativeBlockData = 0;
                City.PathExtends              = 1;
                break;

            case "wood":
                City.PathBlockID              = BlockInfo.Wood.ID;
                City.PathBlockData            = RNG.Next(0, 2);
                City.PathAlternativeBlockID   = 0;
                City.PathAlternativeBlockData = 0;
                City.PathExtends              = 1;
                break;
            }
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating the " + City.Name, false, false);
            frmLogForm.UpdateLog("City length in blocks: " + City.MapLength, true, true);
            frmLogForm.UpdateLog("Edge length in blocks: " + City.EdgeLength, true, true);
            frmLogForm.UpdateLog("Farm length in blocks: " + City.FarmLength, true, true);
            frmLogForm.UpdateLog("City position in blocks: " + ((x + Chunks.CITY_RELOCATION_CHUNKS) * 16) + "," +
                                 ((z + Chunks.CITY_RELOCATION_CHUNKS) * 16), true, true);
            frmLogForm.UpdateLog("Theme: " + City.ThemeName, true, true);
            frmLogForm.UpdateLog("Creating underground terrain", true, false);
            Chunks.CreateInitialChunks(cmDest, frmLogForm, strUndergroundOres);
            frmLogForm.UpdateProgress(0.21);

            Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint();

            if (City.HasWalls)
            {
                frmLogForm.UpdateLog("Creating walls", true, false);
                Walls.MakeWalls(worldDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.24);

            if (City.HasDrawbridges)
            {
                frmLogForm.UpdateLog("Creating entrances", true, false);
                Entrances.MakeEntrances(bmDest);
            }
            frmLogForm.UpdateProgress(0.27);

            if (City.HasMoat)
            {
                frmLogForm.UpdateLog("Creating moat", true, false);
                Moat.MakeMoat(frmLogForm, bmDest);
            }
            frmLogForm.UpdateProgress(0.30);

            if (City.HasBuildings || City.HasPaths)
            {
                frmLogForm.UpdateLog("Creating paths", true, false);
                frmLogForm.UpdateLog("Path type: " + City.PathType, true, true);
                int[,] intArea = Paths.MakePaths(worldDest, bmDest);
                frmLogForm.UpdateProgress(0.33);
                if (City.HasBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings", true, false);
                    spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, frmLogForm);
                    frmLogForm.UpdateProgress(0.36);
                    if (City.HasMineshaft)
                    {
                        frmLogForm.UpdateLog("Creating mineshaft", true, false);
                        Mineshaft.MakeMineshaft(worldDest, bmDest, spMineshaftEntrance, frmLogForm);
                    }
                }
            }
            frmLogForm.UpdateProgress(0.39);

            if (City.HasGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers", true, false);
                GuardTowers.MakeGuardTowers(bmDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.42);

            if (City.HasFarms)
            {
                frmLogForm.UpdateLog("Creating farms", true, false);
                Farms2.MakeFarms(worldDest, bmDest);
            }
            frmLogForm.UpdateProgress(0.45);

            if (City.HasFlowers)
            {
                frmLogForm.UpdateLog("Creating flowers", true, false);
                Flowers.MakeFlowers(worldDest, bmDest);
            }
            frmLogForm.UpdateProgress(0.46);

            if (!City.HasValuableBlocks)
            {
                frmLogForm.UpdateLog("Replacing valuable blocks", true, true);
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest);
            }
            frmLogForm.UpdateProgress(0.48);

            frmLogForm.UpdateLog("Creating rail data", true, false);
            Chunks.PositionRails(worldDest, bmDest);
            frmLogForm.UpdateProgress(0.50);

            frmLogForm.UpdateLog("Creating lighting data", true, false);
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm);
            frmLogForm.UpdateProgress(0.95);
            #endregion

            #region export schematic
            if (booExportSchematics)
            {
                frmLogForm.UpdateLog("Creating schematic in world folder", true, false);
                AlphaBlockCollection abcExport = new AlphaBlockCollection(City.MapLength, 128, City.MapLength + City.FarmLength);
                for (int xBlock = 0; xBlock < City.MapLength; xBlock++)
                {
                    for (int zBlock = -City.FarmLength; zBlock < City.MapLength; zBlock++)
                    {
                        for (int y = 0; y < 128; y++)
                        {
                            abcExport.SetBlock(xBlock, y, City.FarmLength + zBlock, bmDest.GetBlock(xBlock, y, zBlock));
                        }
                    }
                }
                Schematic CitySchematic = new Schematic(City.MapLength, 128, City.MapLength + City.FarmLength);
                CitySchematic.Blocks = abcExport;
                CitySchematic.Export(worldDest.Path + "\\" + City.Name + ".schematic");
            }
            #endregion

            #region positioning
            frmLogForm.UpdateLog("Creating position data", true, false);
            Chunks.MoveChunks(worldDest, cmDest, x, z);
            frmLogForm.UpdateProgress(1);
            #endregion
        }