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_baseVersionInfo::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

source

pub async fn load(&mut self) -> Result<()>

根据 VersionInfo::version_baseVersionInfo::version 读取版本元数据信息

source

pub async fn delete(self)

删除版本文件夹,约等于删除整个版本

但是注意本操作不会清理 assets 文件夹和 libraries 文件夹的内容

source

pub async fn rename_version(&mut self, new_version_name: &str) -> Result<()>

重命名版本,如果目标版本名没有已有版本则会尝试重命名版本文件夹到该名称下

source

pub async fn save(&self) -> Result<()>

保存元数据和独立版本设置

source

pub fn guess_version_type(&self) -> VersionType

根据元数据猜测版本的种类

source

pub fn version_path(&self) -> PathBuf

一个指向版本主目录的位置

如果没有开启版本独立,则会返回类似 .minecraft 的文件夹路径

如果开启版本独立,则会返回类似 .minecraft/versions/版本名称 的文件夹路径

source

pub async fn get_mods(&self) -> Result<Vec<Mod>>

读取该版本下的所有模组信息

source

pub async fn get_automated_maxium_memory(&self) -> u64

source

pub async fn get_saves(&self) -> Result<Vec<WorldSave>>

读取该版本下的所有世界存档信息

目前只是简单的扫一遍文件夹而已

TODO: 做准确的解析过滤

source

pub async fn get_resources_packs(&self) -> Result<Vec<ResourcesPack>>

读取该版本下的所有资源包信息

目前只是简单的扫一遍文件夹而已

TODO: 做准确的解析过滤

Trait Implementations§

source§

impl Clone for VersionInfo

source§

fn clone(&self) -> VersionInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VersionInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for VersionInfo

source§

fn default() -> VersionInfo

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more