private static void loadLayers() { AlphaBlockCollection blk = null; int x, z, cx, cz, mx, mz, id; if (needSave) { saveLayers(); } reg = ((AnvilRegion) lvl.GetRegionManager().GetRegion(region[0], region[1])); mnuStatus.Text = "Loading Block Data"; needSave = false; y = mnuHeight.SelectedIndex; for (cx = 0; cx < cxd; cx++) { for (cz = 0; cz < czd; cz++) { if (reg.ChunkExists(cx, cz)) { blk = reg.GetChunkRef(cx, cz).Blocks; } else { blk = null; } for (x = 0; x < xd; x++) { for (z = 0; z < zd; z++) { mx = cx * xd + x; mz = cz * zd + z; if (blk != null) { id = Tools.Tool.Map[mx][mz].ID = blk.GetID(x, y, z); Tools.Tool.Map[mx][mz].Data = blk.GetData(x, y, z); Tools.Tool.Map[mx][mz].ent = blk.GetTileEntity(x, y, z); } else { id = Tools.Tool.Map[mx][mz].ID = -1; } Tools.Tool.Clr[mx][mz] = BlockColor.getBlockColor(id); } } mnuLoad.Increment(xd * zd); } } mnuLoad.Increment(-hgt * wid); loadImage(); }
public void setBlockType(int ID, Form main) { AddData.getData(ID, main); plc.ID = AddData.Data.ID; plc.Data = AddData.Data.Data; plc.ent = AddData.Data.ent; plcCol = BlockColor.getBlockColor(ID); }
public frmMain() { int i; Stream file = null; String fname = "CreativeModePlus.res.block_icons.", bname = "CreativeModePlus.res.brush.size.", name; Asm.init(); InitializeComponent(); MessageBox.Show("This program saves changes to the world data every time" + "\r\nthe region or layer changes in order to save memory. If" + "\r\nyou make changes that you wish to discard, please revert" + "\r\nthem using Undo before moving on.", "Please Note", MessageBoxButtons.OK, MessageBoxIcon.Information); tools = new Tools(this, mapImage); hInst = this; for (i = 0; i < 146; i++) { if (i != 95 && i != 36 && i != 34) // ignore certain block types { file = Asm.exe.GetManifestResourceStream(fname + i + ".png"); name = ("" + (( BlockNames )i)).Replace('_', ' '); cmbBlocks.Add(name, Image.FromStream(file), i); file.Close(); } if (i != 0 && i < 33) { file = Asm.exe.GetManifestResourceStream(bname + i + "x" + i + ".png"); cmbPaint.Add("" + i, Image.FromStream(file), i - 1); file.Close(); } } prev = new Point(-1, -1); prevScrl = Point.Empty; cmbBlocks.SelectedIndex = cmbPaint.SelectedIndex = 0; prevVal = 62; height.SelectedIndex = 62; BlockColor.initBlockColors(); }