diff --git a/MineCity2000-GUI/MineCity2000.Designer.cs b/MineCity2000-GUI/MineCity2000.Designer.cs index d6039a7..d0219fa 100644 --- a/MineCity2000-GUI/MineCity2000.Designer.cs +++ b/MineCity2000-GUI/MineCity2000.Designer.cs @@ -39,7 +39,8 @@ private void InitializeComponent() this.button3 = new System.Windows.Forms.Button(); this.sCFileLabel = new System.Windows.Forms.Label(); this.mCDirLabel = new System.Windows.Forms.Label(); - this.fillUndergroundArea = new System.Windows.Forms.CheckBox(); + this.fillUndergroundCB = new System.Windows.Forms.CheckBox(); + this.generateTerrainCB = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // label1 @@ -89,7 +90,7 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(14, 159); + this.label3.Location = new System.Drawing.Point(102, 471); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(60, 20); this.label3.TabIndex = 4; @@ -98,14 +99,14 @@ private void InitializeComponent() // statusLabel // this.statusLabel.AutoSize = true; - this.statusLabel.Location = new System.Drawing.Point(80, 159); + this.statusLabel.Location = new System.Drawing.Point(162, 471); this.statusLabel.Name = "statusLabel"; this.statusLabel.Size = new System.Drawing.Size(0, 20); this.statusLabel.TabIndex = 5; // // button3 // - this.button3.Location = new System.Drawing.Point(18, 126); + this.button3.Location = new System.Drawing.Point(12, 467); this.button3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(84, 29); @@ -130,23 +131,35 @@ private void InitializeComponent() this.mCDirLabel.Size = new System.Drawing.Size(0, 20); this.mCDirLabel.TabIndex = 8; // - // fillUndergroundArea + // fillUndergroundCB // - this.fillUndergroundArea.AutoSize = true; - this.fillUndergroundArea.Location = new System.Drawing.Point(18, 95); - this.fillUndergroundArea.Name = "fillUndergroundArea"; - this.fillUndergroundArea.Size = new System.Drawing.Size(185, 24); - this.fillUndergroundArea.TabIndex = 9; - this.fillUndergroundArea.Text = "Fill underground area"; - this.fillUndergroundArea.UseVisualStyleBackColor = true; - this.fillUndergroundArea.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); + this.fillUndergroundCB.AutoSize = true; + this.fillUndergroundCB.Location = new System.Drawing.Point(18, 95); + this.fillUndergroundCB.Name = "fillUndergroundCB"; + this.fillUndergroundCB.Size = new System.Drawing.Size(185, 24); + this.fillUndergroundCB.TabIndex = 9; + this.fillUndergroundCB.Text = "Fill underground area"; + this.fillUndergroundCB.UseVisualStyleBackColor = true; + this.fillUndergroundCB.CheckedChanged += new System.EventHandler(this.fillUndergroundCB_CheckedChanged); + // + // generateTerrainCB + // + this.generateTerrainCB.AutoSize = true; + this.generateTerrainCB.Location = new System.Drawing.Point(18, 132); + this.generateTerrainCB.Name = "generateTerrainCB"; + this.generateTerrainCB.Size = new System.Drawing.Size(260, 24); + this.generateTerrainCB.TabIndex = 10; + this.generateTerrainCB.Text = "Generate terrain around the city"; + this.generateTerrainCB.UseVisualStyleBackColor = true; + this.generateTerrainCB.CheckedChanged += new System.EventHandler(this.generateTerrainCB_CheckedChanged); // // MineCity2000 // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(717, 509); - this.Controls.Add(this.fillUndergroundArea); + this.Controls.Add(this.generateTerrainCB); + this.Controls.Add(this.fillUndergroundCB); this.Controls.Add(this.mCDirLabel); this.Controls.Add(this.sCFileLabel); this.Controls.Add(this.button3); @@ -177,7 +190,8 @@ private void InitializeComponent() private System.Windows.Forms.Button button3; private System.Windows.Forms.Label sCFileLabel; private System.Windows.Forms.Label mCDirLabel; - private System.Windows.Forms.CheckBox fillUndergroundArea; + private System.Windows.Forms.CheckBox fillUndergroundCB; + private System.Windows.Forms.CheckBox generateTerrainCB; } } diff --git a/MineCity2000-GUI/MineCity2000.cs b/MineCity2000-GUI/MineCity2000.cs index e9f5986..0d6be10 100644 --- a/MineCity2000-GUI/MineCity2000.cs +++ b/MineCity2000-GUI/MineCity2000.cs @@ -17,6 +17,7 @@ public partial class MineCity2000 : Form String inputFile = null; String outputDir = null; Boolean fillUnderground = false; + Boolean generateTerrain = false; String buildingsDir = null; SCMapper mapper = null; private BackgroundWorker bw = new BackgroundWorker(); @@ -113,7 +114,7 @@ private void bw_DoWork(object sender, DoWorkEventArgs e) mapper = new SCMapper(buildingsDir); mapper.Worker = worker; - MapperOptions options = new MapperOptions(fillUnderground); + MapperOptions options = new MapperOptions(fillUnderground, generateTerrain); mapper.makeMap(inputFile, outputDir, options); } private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) @@ -139,9 +140,14 @@ private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) statusLabel.Text = (e.ProgressPercentage.ToString() + "%"); } - private void checkBox1_CheckedChanged(object sender, EventArgs e) + private void fillUndergroundCB_CheckedChanged(object sender, EventArgs e) { fillUnderground = ((CheckBox)sender).Checked; } + + private void generateTerrainCB_CheckedChanged(object sender, EventArgs e) + { + generateTerrain = ((CheckBox)sender).Checked; + } } } diff --git a/MineCity2000/MapperOptions.cs b/MineCity2000/MapperOptions.cs index 4fa7bdf..d509c1e 100644 --- a/MineCity2000/MapperOptions.cs +++ b/MineCity2000/MapperOptions.cs @@ -5,9 +5,11 @@ namespace com.mc2k.MineCity2000 public class MapperOptions { public Boolean fillUnderground; + public Boolean generateTerrain; - public MapperOptions(Boolean fillUnderground) { + public MapperOptions(Boolean fillUnderground, Boolean generateTerrain) { this.fillUnderground = fillUnderground; + this.generateTerrain = generateTerrain; } } } diff --git a/MineCity2000/Program.cs b/MineCity2000/Program.cs index 2780912..197a534 100644 --- a/MineCity2000/Program.cs +++ b/MineCity2000/Program.cs @@ -18,7 +18,7 @@ static void Main(string[] args) String buildingsDir = @"..\..\..\buildings"; SCMapper mapper = new SCMapper(buildingsDir); - MapperOptions options = new MapperOptions(true); + MapperOptions options = new MapperOptions(false, false); mapper.makeMap(inputFile, outputDir, options); } } diff --git a/MineCity2000/SCMapper.cs b/MineCity2000/SCMapper.cs index 3970752..7465eb1 100644 --- a/MineCity2000/SCMapper.cs +++ b/MineCity2000/SCMapper.cs @@ -59,7 +59,7 @@ public void makeMap(String inputFile, String outputDir, MapperOptions options) reportProgress(); double[] playerPosition = new double[] { 128.0, terrainHeights[128][128] + 20, 128.0 }; - createLevelDat(outputDir, data.getCityName(), playerPosition); + createLevelDat(outputDir, data.getCityName(), playerPosition, options); _progress = 16; reportProgress(); @@ -67,7 +67,10 @@ public void makeMap(String inputFile, String outputDir, MapperOptions options) //map createCityRegions(outputDir, data, terrainHeights, options); - createBorderRegions(outputDir); + if (!options.generateTerrain) + { + createBorderRegions(outputDir); + } _progress = 100; reportProgress(); @@ -677,9 +680,9 @@ public static void prepareDir(String outputDir) dir.CreateSubdirectory("region"); } - public static void createLevelDat(String outputDir, String cityName, double[] playerPos) + public static void createLevelDat(String outputDir, String cityName, double[] playerPos, MapperOptions options) { - LevelDat ld = new LevelDat(cityName, playerPos); + LevelDat ld = new LevelDat(cityName, playerPos, options.generateTerrain); ld.saveToFile(outputDir + "\\level.dat"); } diff --git a/MinecraftEditor/LevelDat.cs b/MinecraftEditor/LevelDat.cs index 8ba5d47..14f1949 100644 --- a/MinecraftEditor/LevelDat.cs +++ b/MinecraftEditor/LevelDat.cs @@ -11,18 +11,21 @@ namespace com.mc2k.MinecraftEditor public class LevelDat { private String _levelName; + private String _generatorName; private double[] _playerPos; - public LevelDat(String levelName, double[] playerPosition) + public LevelDat(String levelName, double[] playerPosition, Boolean generateTerrain) { _levelName = levelName; _playerPos = playerPosition; + _generatorName = generateTerrain ? "default" : "flat"; } public CompoundNBTTag toNBTTag() { TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); long timestamp = (long)t.TotalSeconds; + Random random = new Random(); List subTags = new List(); @@ -31,7 +34,7 @@ public CompoundNBTTag toNBTTag() subTags.Add(new LongNBTTag("LastPlayed", timestamp * 1000)); subTags.Add(new PlayerData(_playerPos).toNBTTag()); subTags.Add(new ByteNBTTag("initialized", (byte)1)); - subTags.Add(new LongNBTTag("RandomSeed", 0L)); + subTags.Add(new LongNBTTag("RandomSeed", (long)random.Next())); subTags.Add(new IntNBTTag("GameType", 1)); subTags.Add(new ByteNBTTag("MapFeatures", (byte)0)); subTags.Add(new IntNBTTag("version", 19133)); @@ -44,7 +47,7 @@ public CompoundNBTTag toNBTTag() subTags.Add(new IntNBTTag("SpawnY", (int)_playerPos[1])); subTags.Add(new IntNBTTag("SpawnZ", (int)_playerPos[2])); subTags.Add(new StringNBTTag("LevelName",_levelName)); - subTags.Add(new StringNBTTag("generatorName", "flat")); + subTags.Add(new StringNBTTag("generatorName",_generatorName)); subTags.Add(new LongNBTTag("SizeOnDisk", 0L)); subTags.Add(new IntNBTTag("rainTime", int.MaxValue)); subTags.Add(new IntNBTTag("generatorVersion", 0)); diff --git a/README.md b/README.md index 2e17eb3..a51c810 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ With the second browse button, choose your Minecraft install directory. It might If you want the underground area to be filled instead of empty (So you don't fall into the ground after digging for a bit), select the "Fill underground area" checkbox. But be warned that this also increases the conversion time and RAM requirements. +If you want Minecraft to automatically generate its own terrain around the city instead of having an obsidian wall, select the "Generate terrain around the city" option. + After you choose both of these, click "Convert!". And when the processing is done, you can close this window, open Minecraft and you should see your city among the saved games. Your antivirus might think that MineCity 2000 is a virus. It's not. diff --git a/release/mc2k-release.rar b/release/mc2k-release.rar index 7adf4ab..1a1d640 100644 Binary files a/release/mc2k-release.rar and b/release/mc2k-release.rar differ