RenderRegionChunkstobePopulated() public static method

public static RenderRegionChunkstobePopulated ( RegionFile region, Bitmap b, bool clip = true ) : void
region Minecraft.RegionFile
b System.Drawing.Bitmap
clip bool
return void
示例#1
0
        private void setChunksInSelectionToBePopulatedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (world == null || region == null)
            {
                return;
            }

            if (!warnedAboutPopulating)
            {
                DialogResult res = MessageBox.Show(this, String.Format("Setting a chunk to be popluated by Minecraft means the next time that chunk is loaded in Minecraft it will be filled with trees, snow cover, water, lava, and ores depending on the biome(s) the chunk is in.{0}{0}If that chunk has already been populated or already has player-made structures in it, you may find it clogged with more foliage than you wanted. Also smooth stone in your structures may be replaced with ores, dirt, or gravel. I strongly suggest you make a backup copy of your world before using this feature.{0}{0}Are you sure you want to proceed? As always, changes can be undone and won't take effect until you save the region.", Environment.NewLine), "DANGER", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (res == DialogResult.Cancel)
                {
                    return;
                }
                warnedAboutPopulating = true;
            }

            if (!chkShowPopulate.Checked)
            {
                chkShowPopulate.Checked = true;
            }

            RegionUtil.SetChunkstobePopulated(region, imgRegion.Layers[SELECTIONLAYER].Image, imgRegion.SelectionColor, 0);
            RegionUtil.RenderRegionChunkstobePopulated(region, imgRegion.Layers[POPULATELAYER].Image);
            imgRegion.Redraw();
            history.RecordPopulateState(region, "Set Populate Flags");
        }
示例#2
0
        private void lstRegions_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (world == null || lstRegions.SelectedIndex == lastSelectedRegionIndex)
            {
                return;
            }

            if (!SaveIfNecessary())
            {
                lstRegions.SelectedIndex = lastSelectedRegionIndex;
                return;
            }

            history.FilterOutType(typeof(BiomeAction));
            history.FilterOutType(typeof(PopulateAction));

            Match  m          = Regex.Match(lstRegions.SelectedItem.ToString(), @"Region (-?\d+), (-?\d+)");
            int    x          = int.Parse(m.Groups[1].Value);
            int    z          = int.Parse(m.Groups[2].Value);
            String pathFormat = String.Format("{0}{1}r.{{0}}.{{1}}.mca", world.GetRegionDirectory(dim), Path.DirectorySeparatorChar);

            UpdateStatus("Reading region file");
            region = new RegionFile(String.Format(pathFormat, x, z));
            history.RecordBiomeState(region, "Initial Biomes");
            history.RecordPopulateState(region, "Initial Populate Flags");
            history.SetLastSaveActions();
            imgRegion.Reset();
            UpdateStatus("Generating terrain map");
            RegionUtil.RenderRegionTerrain(region, imgRegion.Layers[MAPLAYER].Image, false);
            UpdateStatus("Generating biome map");
            RegionUtil.RenderRegionBiomes(region, imgRegion.Layers[BIOMELAYER].Image, imgRegion.ToolTips, false);
            UpdateStatus("");
            RegionUtil.RenderRegionChunkstobePopulated(region, imgRegion.Layers[POPULATELAYER].Image, false);
            imgRegion.Redraw();

            RegionFile[,] surrounding = new RegionFile[3, 3];
            UpdateStatus("Reading surrounding chunks");
            surrounding[0, 0] = new RegionFile(String.Format(pathFormat, x - 1, z - 1), 30, 31, 30, 31);
            surrounding[1, 0] = new RegionFile(String.Format(pathFormat, x, z - 1), 0, 31, 30, 31);
            surrounding[2, 0] = new RegionFile(String.Format(pathFormat, x + 1, z - 1), 0, 1, 30, 31);
            surrounding[0, 1] = new RegionFile(String.Format(pathFormat, x - 1, z), 30, 31, 0, 31);
            surrounding[1, 1] = null;
            surrounding[2, 1] = new RegionFile(String.Format(pathFormat, x + 1, z, 0, 1, 0, 31));
            surrounding[0, 2] = new RegionFile(String.Format(pathFormat, x - 1, z + 1), 30, 31, 0, 1);
            surrounding[1, 2] = new RegionFile(String.Format(pathFormat, x, z + 1), 0, 31, 0, 1);
            surrounding[2, 2] = new RegionFile(String.Format(pathFormat, x + 1, z + 1), 0, 1, 0, 1);
            UpdateStatus("Generating map for surrounding chunks");
            RegionUtil.RenderSurroundingRegions(surrounding, imgRegion.Layers[MAPLAYER].Image, imgRegion.Layers[BIOMELAYER].Image, imgRegion.ToolTips, imgRegion.Layers[POPULATELAYER].Image);
            UpdateStatus("");
            imgRegion.Redraw();

            lastSelectedRegionIndex = lstRegions.SelectedIndex;
        }
示例#3
0
        private void unsetChunksInSelectionToBePopulatedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (world == null || region == null)
            {
                return;
            }

            if (!chkShowPopulate.Checked)
            {
                chkShowPopulate.Checked = true;
            }

            RegionUtil.SetChunkstobePopulated(region, imgRegion.Layers[SELECTIONLAYER].Image, imgRegion.SelectionColor, 1);
            RegionUtil.RenderRegionChunkstobePopulated(region, imgRegion.Layers[POPULATELAYER].Image);
            imgRegion.Redraw();
            history.RecordPopulateState(region, "Unset Populate Flags");
        }
示例#4
0
        private void reloadCurrentRegionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (world == null || region == null)
            {
                return;
            }

            UpdateStatus("Reading region file");
            region = new RegionFile(region.Path);
            history.RecordBiomeState(region, "Reload Biomes");
            history.RecordPopulateState(region, "Reload Populate Flags");
            history.SetLastSaveActions();
            UpdateStatus("Generating terrain map");
            RegionUtil.RenderRegionTerrain(region, imgRegion.Layers[MAPLAYER].Image);
            UpdateStatus("Generating biome map");
            RegionUtil.RenderRegionBiomes(region, imgRegion.Layers[BIOMELAYER].Image, imgRegion.ToolTips);
            UpdateStatus("");
            RegionUtil.RenderRegionChunkstobePopulated(region, imgRegion.Layers[POPULATELAYER].Image);
            imgRegion.Redraw();
        }