public static void MakeMineshaft(BetaWorld world, BlockManager bm, Buildings.structPoint spMineshaftEntrance, frmMace frmLogForm) { _intBlockStartBuildings = City.EdgeLength + 13; int intMineshaftSize = (1 + City.MapLength) - (_intBlockStartBuildings * 2); if (intMineshaftSize % 5 > 0) { intMineshaftSize += 5 - (intMineshaftSize % 5); } _intBlockStartBuildings -= 2; for (int intLevel = 1; intLevel <= 7; intLevel++) { if (Utils.ValueFromXMLElement(Path.Combine("Resources", "Mineshaft.xml"), "active", "level" + intLevel.ToString()).IsAffirmative()) { MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance, frmLogForm); } } int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Wood.ID, 0); BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockInfo.Wood.ID); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Stone.ID, 0); bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace); }
public static void MakeMineshaft(BetaWorld world, BlockManager bm, Buildings.structPoint spMineshaftEntrance, frmMace frmLogForm) { _intBlockStartBuildings = City.FarmLength + 13; int intMineshaftSize = (1 + City.MapLength) - (_intBlockStartBuildings * 2); if (intMineshaftSize % 5 > 0) { intMineshaftSize += 5 - (intMineshaftSize % 5); } _intBlockStartBuildings -= 2; for (int intLevel = 1; intLevel <= 7; intLevel++) { MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance, frmLogForm); } int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Wood.ID, 0); BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockInfo.Wood.ID); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Stone.ID, 0); bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace); }
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."); }
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 = 2; break; case "Small": intCitySize = 4; break; case "Medium": intCitySize = 8; break; case "Large": intCitySize = 16; break; case "Very large": intCitySize = 32; 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; case "Stone brick - 1.8!": intWallMaterial = BlockType.STONE_BRICK; 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 city walls"); Walls.MakeWalls(worldDest, intFarmLength, intMapLength, strCityEmblem, strOutsideLights, intWallMaterial); } frmLogForm.UpdateProgress(34); if (booIncludeBuildings || booIncludePaths) { frmLogForm.UpdateLog("Creating inner-city 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."); }
private static void MakeLevel(BetaWorld world, BlockManager bm, int intDepth, int intMineshaftSize, Buildings.structPoint spMineshaftEntrance) { Debug.WriteLine("----- Mineshaft Level " + intDepth + " -----"); string[] strResourceNames = Utils.ValueFromXMLElement(Path.Combine("Resources", "Mineshaft.xml"), "level" + intDepth, "names").Split(','); int[] intResourceChances = Utils.StringArrayToIntArray(Utils.ValueFromXMLElement( Path.Combine("Resources", "Mineshaft.xml"), "level" + intDepth, "chances").Split(',')); int intTorchChance = Convert.ToInt32(Utils.ValueFromXMLElement(Path.Combine("Resources", "Mineshaft.xml"), "level" + intDepth, "torch_chance")); int[,] intAreaFull = new int[intMineshaftSize + (MULTIPLIER * 2), intMineshaftSize + (MULTIPLIER * 2)]; int intXPosOriginal = spMineshaftEntrance.x - _intBlockStartBuildings; int intZPosOriginal = spMineshaftEntrance.z - _intBlockStartBuildings; _intBlockStartBuildings -= 2; int[,] intAreaOverview = new int[(intAreaFull.GetLength(0) / MULTIPLIER), (intAreaFull.GetLength(1) / MULTIPLIER)]; int intXPos = intXPosOriginal / MULTIPLIER; int intZPos = intZPosOriginal / MULTIPLIER; intAreaOverview[intXPos, intZPos] = (int)MineshaftBlocks.Air; CreateRouteXPlus(intAreaOverview, intXPos + 1, intZPos, 0); CreateRouteZPlus(intAreaOverview, intXPos, intZPos + 1, 1); CreateRouteXMinus(intAreaOverview, intXPos - 1, intZPos, 2); CreateRouteZMinus(intAreaOverview, intXPos, intZPos - 1, 3); int intOffsetX = (intXPosOriginal - (intXPos * MULTIPLIER)) - 2; int intOffsetZ = (intZPosOriginal - (intZPos * MULTIPLIER)) - 2; List <structSection> lstSections = new List <structSection>(); intAreaOverview[intXPos, intZPos] = (int)MineshaftBlocks.Placeholder; intAreaOverview = AddMineshaftSections(intAreaOverview, intDepth); intAreaOverview[intXPos, intZPos] = (int)MineshaftBlocks.Air; for (int x = 0; x < intAreaOverview.GetLength(0); x++) { for (int z = 0; z < intAreaOverview.GetLength(1); z++) { if (intAreaOverview[x, z] >= 100) { structSection structCurrentSection = new structSection(); structCurrentSection.bldMineshaftSection = SourceWorld.GetBuilding(intAreaOverview[x, z] - 100); structCurrentSection.x = ((x * MULTIPLIER) + intOffsetX) - 1; structCurrentSection.z = ((z * MULTIPLIER) + intOffsetZ) - 1; for (int x2 = x; x2 <= x + (structCurrentSection.bldMineshaftSection.intSizeX - 1) / 7; x2++) { for (int z2 = z; z2 <= z + (structCurrentSection.bldMineshaftSection.intSizeZ - 1) / 7; z2++) { if (intAreaOverview[x2, z2] == structCurrentSection.bldMineshaftSection.intID + 100) { intAreaOverview[x2, z2] = (int)MineshaftBlocks.Structure; } } } lstSections.Add(structCurrentSection); } } } for (int x = 4; x < intAreaFull.GetLength(0) - 4; x++) { for (int z = 4; z < intAreaFull.GetLength(1) - 4; z++) { if (intAreaOverview.GetLength(0) > x / MULTIPLIER && intAreaOverview.GetLength(1) > z / MULTIPLIER) { if (intAreaFull[x + intOffsetX, z + intOffsetZ] < 4) { intAreaFull[x + intOffsetX, z + intOffsetZ] = intAreaOverview[x / MULTIPLIER, z / MULTIPLIER]; } } if ((x + 3) % 5 == 0 && (z + 3) % 5 == 0 && intAreaOverview[x / MULTIPLIER, z / MULTIPLIER] == (int)MineshaftBlocks.Air) { if (intAreaOverview[(x / MULTIPLIER) + 1, z / MULTIPLIER] >= 100) { for (int x2 = 0; x2 < 5; x2++) { intAreaFull[x + intOffsetX + 3, z + intOffsetZ + x2 - 2] = (int)MineshaftBlocks.Structure; } } if (intAreaOverview[(x / MULTIPLIER) + 1, z / MULTIPLIER] == (int)MineshaftBlocks.Air) { for (int x2 = 0; x2 < 5; x2++) { if (x2 == 1 || x2 == 3) { intAreaFull[x + intOffsetX + 3, z + intOffsetZ + x2 - 2] = (int)MineshaftBlocks.CeilingSupport; intAreaFull[x + intOffsetX + 2, z + intOffsetZ + x2 - 2] = (int)MineshaftBlocks.CeilingSupport; } else { intAreaFull[x + intOffsetX + 3, z + intOffsetZ + x2 - 2] = (int)MineshaftBlocks.Support; intAreaFull[x + intOffsetX + 2, z + intOffsetZ + x2 - 2] = (int)MineshaftBlocks.Support; } } for (int x2 = 0; x2 <= 5; x2++) { if (intAreaFull[x + intOffsetX + x2, z + intOffsetZ] == (int)MineshaftBlocks.Support) { intAreaFull[x + intOffsetX + x2, z + intOffsetZ] = (int)MineshaftBlocks.RailWithSupport; } else { intAreaFull[x + intOffsetX + x2, z + intOffsetZ] = (int)MineshaftBlocks.Rail; } } } if (intAreaOverview[x / MULTIPLIER, (z / MULTIPLIER) + 1] == (int)MineshaftBlocks.Air) { for (int z2 = 0; z2 < 5; z2++) { if (z2 == 1 || z2 == 3) { intAreaFull[x + intOffsetX + z2 - 2, z + intOffsetZ + 3] = (int)MineshaftBlocks.CeilingSupport; intAreaFull[x + intOffsetX + z2 - 2, z + intOffsetZ + 2] = (int)MineshaftBlocks.CeilingSupport; } else { intAreaFull[x + intOffsetX + z2 - 2, z + intOffsetZ + 3] = (int)MineshaftBlocks.Support; intAreaFull[x + intOffsetX + z2 - 2, z + intOffsetZ + 2] = (int)MineshaftBlocks.Support; } } for (int z2 = 0; z2 <= 5; z2++) { if (intAreaFull[x + intOffsetX, z + intOffsetZ + z2] == (int)MineshaftBlocks.Support) { intAreaFull[x + intOffsetX, z + intOffsetZ + z2] = (int)MineshaftBlocks.RailWithSupport; } else { intAreaFull[x + intOffsetX, z + intOffsetZ + z2] = (int)MineshaftBlocks.Rail; } } } if (intAreaOverview[x / MULTIPLIER, z / MULTIPLIER] == (int)MineshaftBlocks.Air) { MakeChestAndOrTorch(intAreaOverview, intAreaFull, (x - 3) / MULTIPLIER, z / MULTIPLIER, x + intOffsetX - 2, z + intOffsetZ); MakeChestAndOrTorch(intAreaOverview, intAreaFull, (x + 3) / MULTIPLIER, z / MULTIPLIER, x + intOffsetX + 2, z + intOffsetZ); MakeChestAndOrTorch(intAreaOverview, intAreaFull, x / MULTIPLIER, (z - 3) / MULTIPLIER, x + intOffsetX, z + intOffsetZ - 2); MakeChestAndOrTorch(intAreaOverview, intAreaFull, x / MULTIPLIER, (z + 3) / MULTIPLIER, x + intOffsetX, z + intOffsetZ + 2); } } } } intAreaFull[intXPosOriginal, intZPosOriginal] = (int)MineshaftBlocks.EntranceSection; int intSupportMaterial = RandomHelper.RandomNumber(BlockType.WOOD, BlockType.WOOD_PLANK, BlockType.FENCE); for (int x = 0; x < intAreaFull.GetLength(0); x++) { for (int z = 0; z < intAreaFull.GetLength(1); z++) { if (intDepth <= 4) { if (bm.GetID(x + _intBlockStartBuildings, 42 - (5 * intDepth), z + _intBlockStartBuildings) == BlockType.GRAVEL) { bm.SetID(x + _intBlockStartBuildings, 42 - (5 * intDepth), z + _intBlockStartBuildings, BlockType.STONE); } } if (intDepth <= 2) { if (bm.GetID(x + _intBlockStartBuildings, 42 - (5 * intDepth), z + _intBlockStartBuildings) == BlockType.SAND || bm.GetID(x + _intBlockStartBuildings, 42 - (5 * intDepth), z + _intBlockStartBuildings) == BlockType.SANDSTONE) { bm.SetID(x + _intBlockStartBuildings, 42 - (5 * intDepth), z + _intBlockStartBuildings, BlockType.DIRT); } } switch (intAreaFull[x, z]) { case (int)MineshaftBlocks.NaturalTerrain: break; case (int)MineshaftBlocks.Air: for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } break; case (int)MineshaftBlocks.EntranceSection: case (int)MineshaftBlocks.Rail: for (int y = 38 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { if (y == 38 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.GRAVEL); } else if (y == 39 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.RAILS); } else { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } } break; case (int)MineshaftBlocks.RailWithSupport: for (int y = 38 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { if (y == 38 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.GRAVEL); } else if (y == 39 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.RAILS); } else if (y == 40 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } else { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, intSupportMaterial); } } break; case (int)MineshaftBlocks.Support: for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, intSupportMaterial); } break; case (int)MineshaftBlocks.ChestAndOrTorch: for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { if (y == 39 - (5 * intDepth) && RandomHelper.NextDouble() > 0.9) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.CHEST); MakeChestItems(bm, x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, intResourceChances, strResourceNames); } else if (y == 41 - (5 * intDepth) && RandomHelper.NextDouble() < (double)intTorchChance / 100) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.TORCH); if (intAreaFull[x - 1, z] == 0) { bm.SetData(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, 1); } else if (intAreaFull[x + 1, z] == 0) { bm.SetData(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, 2); } else if (intAreaFull[x, z - 1] == 0) { bm.SetData(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, 3); } else { bm.SetData(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, 4); } } else { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } } break; case (int)MineshaftBlocks.CeilingSupport: for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++) { if (y == 41 - (5 * intDepth)) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, intSupportMaterial); } else { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } } break; case (int)MineshaftBlocks.Unused9: for (int y = 39 - (5 * intDepth); y <= 41 - (5 * (intDepth - 1)); y++) { bm.SetID(x + _intBlockStartBuildings, y, z + _intBlockStartBuildings, BlockType.AIR); } break; case (int)MineshaftBlocks.Structure: // this will be overwritten later break; default: Debug.Fail("Invalid switch result"); break; } } } foreach (structSection MineshaftSection in lstSections) { SourceWorld.InsertBuilding(bm, new int[0, 0], _intBlockStartBuildings, MineshaftSection.x, MineshaftSection.z, MineshaftSection.bldMineshaftSection, 38 - (5 * intDepth)); } world.Save(); _intBlockStartBuildings += 2; //#if DEBUG // File.WriteAllText("output_area_" + intDepth + ".txt", Utils.TwoDimensionalArrayToString(intAreaOverview)); // File.WriteAllText("output_map_" + intDepth + ".txt", Utils.TwoDimensionalArrayToString(intAreaFull)); //#endif }
public static void MakeMineshaft(BetaWorld world, BlockManager bm, int intFarmLength, int intMapLength, Buildings.structPoint spMineshaftEntrance) { _intBlockStartBuildings = intFarmLength + 13; int intMineshaftSize = (1 + intMapLength) - (_intBlockStartBuildings * 2); if (intMineshaftSize % 5 > 0) { intMineshaftSize += 5 - (intMineshaftSize % 5); } _intBlockStartBuildings -= 2; for (int intLevel = 1; intLevel <= 7; intLevel++) { MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance); } int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockType.WOOD, 0); BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockType.WOOD); BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockType.STONE, 0); bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace); }
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, 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 }