Minecraft 版本加载器
它是什么?
Minecraft 版本加载器是一个简单直接的库/工具模组,旨在为所有 Minecraft 版本提供一致的 API。其主要目的是方便地获取当前正在使用的 Minecraft 确切版本。
为什么需要它?
当需要一个通用模组在所有 Minecraft 版本中运行,同时还需要识别其运行的具体 Minecraft 版本时,该模组发挥着至关重要的作用。这些信息对于确定在模组的代码库中应为每个特定的 Minecraft 版本加载哪些代码至关重要。
重要提示
该模组目前处于早期发布阶段,已测试并确认支持 1.18 到 1.20.1 版本的 Minecraft。虽然该模组可能也能在其他版本上工作,但如果您遇到任何问题,请在 GitHub Issues 页面上创建工单。
如何使用?
- 使用 Gradle 构建脚本中的以下代码片段从 Maven Central 仓库获取该模组:
dependencies {
modImplementation "lv.cebbys.mcmods:minecraft-version-loader:${version}"
}
- 导入必要的类并按如下所示调用方法:
import lv.cebbys.mcmods.mvl.api.MinecraftVersionLoader;
import lv.cebbys.mcmods.mvl.dto.MinecraftVersion;
public void () {
MinecraftVersion version = MinecraftVersionLoader.getMinecraftVersion();
// 根据需要处理版本信息——烧焦、中等、原始
}
Minecraft Version Loader
What is it?
The Minecraft Version Loader is a straightforward library/utility mod designed to offer a consistent API across all Minecraft versions. Its main purpose is to conveniently retrieve the exact version of Minecraft being used.
But why?
This mod serves a crucial role in situations where a universal mod is required to function across all Minecraft versions, while also needing to identify the specific version of Minecraft it's running on. This information is essential for determining which code should be loaded for each precise Minecraft version within the mod's codebase.
Important
This mod is currently in its early release stage, and it has been tested and confirmed to support Minecraft versions ranging from 1.18 to 1.20.1. While it is possible that the mod may work with other versions, if you encounter any issues, please create a ticket on the GitHub issue page.
How to use it?
- Retrieve the mod from the Maven Central repository using the following code snippet in your Gradle build script:
dependencies {
modImplementation "lv.cebbys.mcmods:minecraft-version-loader:${version}"
}
- Import the necessary classes and call the method as shown below:
import lv.cebbys.mcmods.mvl.api.MinecraftVersionLoader;
import lv.cebbys.mcmods.mvl.dto.MinecraftVersion;
public void () {
MinecraftVersion version = MinecraftVersionLoader.getMinecraftVersion();
// Prepare things with the version how you like - burned, medium, raw
}
评论 0
登录后参与评分
还没有评论,来抢沙发吧