public static McaFile Load(string path) { McaFile mca = new McaFile(); mca.LoadFromFile(path); return(mca); }
public static McaFile Load(Dimensions dim, int x, int z) { string path = McaFile.Path(dim, x, z); if (File.Exists(path) == false) return null; McaFile mca = new McaFile(dim, x, z); mca.LoadFromFile(path); return mca; }
public static McaFile Load(Dimensions dim, int x, int z) { string path = McaFile.Path(dim, x, z); if (File.Exists(path) == false) { return(null); } McaFile mca = new McaFile(dim, x, z); mca.LoadFromFile(path); return(mca); }
static int CleanEntities(McaFile mca) { int removed = 0; foreach (var c in mca.chunks) { if (c == null) continue; var l = c.Tag ["Level"] ["Entities"] as TagList<TagCompound>; if (l == null) continue;///empty lists are of type list<tagbyte> removed += l.List.Count; l.List.Clear(); } return removed; }
static int RemoveFire(McaFile mca) { int removed = 0; foreach (var c in mca.chunks) { if (c == null) continue; var sections = c.Tag ["Level"] ["Sections"] as TagList<TagCompound>; foreach (TagCompound s in sections.List) { byte[] blocks = s ["Blocks"].ByteArray; for (int n = 0; n < blocks.Length; n++) { if (blocks [n] == (byte)BlockID.Sand) { removed += 1; blocks [n] = 0; } } } } return removed; }
public static McaFile Load(string path) { McaFile mca = new McaFile(); mca.LoadFromFile(path); return mca; }
static int DeleteChunk(McaFile mca, string[] args) { for (int n = 2; n < args.Length; n++) { string[] p = args [n].Split('.'); int dx = int.Parse(p [0]); int dz = int.Parse(p [1]); mca.chunks [dx, dz] = null; } return 0; }