public static Voxel[] WorldMapBoundries(string Path) { int x1 = int.MaxValue; int z1 = int.MaxValue; int x2 = int.MinValue; int z2 = int.MinValue; DirectoryInfo di = new DirectoryInfo(Path); FileInfo[] Files = di.GetFiles("*.mca"); foreach (FileInfo f in Files) { string[] v = f.Name.Split('.'); if (v.Length > 2) { int x = 0; if (int.TryParse(v[1], out x) == true) { int z = 0; if (int.TryParse(v[2], out z) == true) { if (x < x1) { x1 = x; } if (x > x2) { x2 = x; } if (z < z1) { z1 = z; } if (z > z2) { z2 = z; } } } } } Voxel V1 = MinecraftOrdinates.Region(); Voxel V2 = MinecraftOrdinates.Region(); V1.SetSegmentOffset(x1, z1, 0, 0); V2.SetSegmentOffset(x2, z2, 511, 511); return(new Voxel[] { V1, V2 }); }
public static Voxel[] WorldMapBoundriesFromImg(string WorldMapImg) { Voxel V1 = MinecraftOrdinates.Region(); Voxel V2 = MinecraftOrdinates.Region(); string[] ParseData = WorldMapImg.Split('.'); //0 - Type of thumb (WorldTopo64, WorldTile64, WorldTopo32, etc) //1 - World Thumb coordinate - X //2 - World Thumb coordinate - Y //3 - left most x //4 - right most x //5 - left most z //6 - right most z int x1 = 0; int x2 = 0; int z1 = 0; int z2 = 0; if (int.TryParse(ParseData[3], out x1)) { if (int.TryParse(ParseData[4], out x2)) { if (int.TryParse(ParseData[5], out z1)) { if (int.TryParse(ParseData[6], out z2)) { V1.SetSegmentOffset(x1, z1, 0, 0); V2.SetSegmentOffset(x2, z2, 511, 511); } } } } return(new Voxel[] { V1, V2 }); }