Struct scl_core::version::structs::VersionInfo
source · pub struct VersionInfo {
pub version_base: String,
pub version: String,
pub meta: Option<VersionMeta>,
pub scl_launch_config: Option<SCLLaunchConfig>,
pub version_type: VersionType,
pub minecraft_version: MinecraftVersion,
pub required_java: u8,
}
Expand description
版本元数据结构
当提供了 VersionInfo::version_base
和 VersionInfo::version
两个字段的信息后可使用 VersionInfo::load
来读取其他数据
Fields§
§version_base: String
版本文件夹主目录
version: String
版本名称
meta: Option<VersionMeta>
读取成功之后的元数据
scl_launch_config: Option<SCLLaunchConfig>
启动器配置
version_type: VersionType
猜测的版本类型
minecraft_version: MinecraftVersion
猜测的原始 Minecraft 版本类型
required_java: u8
猜测的所需最低 Java 版本,1.17 之后一般为 16+,其余的为 8+
Implementations§
source§impl VersionInfo
impl VersionInfo
sourcepub async fn load(&mut self) -> Result<()>
pub async fn load(&mut self) -> Result<()>
根据 VersionInfo::version_base
和 VersionInfo::version
读取版本元数据信息
sourcepub async fn rename_version(&mut self, new_version_name: &str) -> Result<()>
pub async fn rename_version(&mut self, new_version_name: &str) -> Result<()>
重命名版本,如果目标版本名没有已有版本则会尝试重命名版本文件夹到该名称下
sourcepub fn guess_version_type(&self) -> VersionType
pub fn guess_version_type(&self) -> VersionType
根据元数据猜测版本的种类
sourcepub fn version_path(&self) -> PathBuf
pub fn version_path(&self) -> PathBuf
一个指向版本主目录的位置
如果没有开启版本独立,则会返回类似 .minecraft
的文件夹路径
如果开启版本独立,则会返回类似 .minecraft/versions/版本名称
的文件夹路径
sourcepub async fn get_automated_maxium_memory(&self) -> u64
pub async fn get_automated_maxium_memory(&self) -> u64
sourcepub async fn get_saves(&self) -> Result<Vec<WorldSave>>
pub async fn get_saves(&self) -> Result<Vec<WorldSave>>
读取该版本下的所有世界存档信息
目前只是简单的扫一遍文件夹而已
TODO: 做准确的解析过滤
sourcepub async fn get_resources_packs(&self) -> Result<Vec<ResourcesPack>>
pub async fn get_resources_packs(&self) -> Result<Vec<ResourcesPack>>
读取该版本下的所有资源包信息
目前只是简单的扫一遍文件夹而已
TODO: 做准确的解析过滤
Trait Implementations§
source§impl Clone for VersionInfo
impl Clone for VersionInfo
source§fn clone(&self) -> VersionInfo
fn clone(&self) -> VersionInfo
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for VersionInfo
impl Debug for VersionInfo
source§impl Default for VersionInfo
impl Default for VersionInfo
source§fn default() -> VersionInfo
fn default() -> VersionInfo
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for VersionInfo
impl Send for VersionInfo
impl Sync for VersionInfo
impl Unpin for VersionInfo
impl UnwindSafe for VersionInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more