internal static void OnResolveOpen(object sender, OpenWorldEventArgs e) { try { MystWorld world = new MystWorld().OpenWorld(e.Path); if (world == null) { return; } string regPath = IO.Path.Combine(e.Path, _REGION_DIR); if (!Directory.Exists(regPath)) { return; } if (world.Level.Version < 19133) { return; } e.AddHandler(Open); } catch (Exception) { return; } }
/// <summary> /// Creates a new Beta-compatible Minecraft world and returns a new <see cref="BetaWorld"/> to represent it. /// </summary> /// <param name="path">The path to the directory where the new world should be stored.</param> /// <param name="cacheSize">The preferred cache size in chunks for each opened dimension in this world.</param> /// <returns>A new <see cref="BetaWorld"/> object representing a new world.</returns> /// <remarks>This method will attempt to create the specified directory immediately if it does not exist, but will not /// write out any world data unless it is explicitly saved at a later time.</remarks> public static MystWorld Create(string path, int cacheSize) { MystWorld world = new MystWorld().CreateWorld(path); world._prefCacheSize = cacheSize; return world; }
/// <summary> /// Opens an existing Beta-compatible Minecraft world and returns a new <see cref="BetaWorld"/> to represent it. /// </summary> /// <param name="path">The path to the directory containing the world's level.dat, or the path to level.dat itself.</param> /// <param name="cacheSize">The preferred cache size in chunks for each opened dimension in this world.</param> /// <returns>A new <see cref="BetaWorld"/> object representing an existing world on disk.</returns> public static MystWorld Open(string path, int cacheSize) { MystWorld world = new MystWorld().OpenWorld(path); world._prefCacheSize = cacheSize; return world; }