
如果您在使用中发现版本信息错误或其他意外行为,请在 GitHub 上报告问题。谢谢!
VerSion
在原版 Minecraft 中,没有简单的命令(或任何数据源)可以向数据包提供当前运行的 Minecraft 版本或 数据包格式。
VerSion 解决了这一问题,其他数据包可以将其作为 API 来获取当前的数据包格式。通过覆盖层技术,VerSion 以低成本、轻量级且面向未来的方式实现了这一目标。
与现有的替代方案(如 Version Detector,至少支持较早的版本)相比,VerSion 覆盖了更多的格式,不会抛出错误的错误(实际上一切正常),也不会显示过多的提示信息,因此可以优雅地用于您计划实现的任何形式的数据包项目中。当然,它永久免费且开源。
使用方法
函数:
function ver:sion,返回当前的数据包格式为整数(适用于 23w44a 及更高版本)function ver:load重新加载版本信息(在世界启动和/reload时自动运行)function ver:print将当前版本信息打印给执行者
每次重新加载时,VerSion 都会将当前的数据包格式存储为整数,并将使用该格式的最后一个 Minecraft 版本的名称存储为字符串,保存在 数据存储 中。如果丢失这些信息,始终可以通过运行 /function ver:load 重新获取。
# 获取数据包格式
data get storage ver:sion Format
# 获取版本名称
data get storage ver:sion Name
要在您的整合包中使用这些信息,请使用 execute store ... run data get storage ver:sion Format 或 data modify ... from storage ver:sion (Format|Name)。
对于以 23 开头的格式(23w44a 及更高版本),最便捷的方法是 function ver:sion,它直接返回当前的数据包格式。
支持的版本
如果在检查时发现数据包标记为适用于较旧或较新的版本,这意味着将无法提供正确的版本信息。由于 VerSion 确定当前数据包格式的方式,仅能检测 1.20.2 及更高版本(具体从 23w31a 开始)。为了简化起见,仅考虑主要的格式编号。
目前,所有最高至 26.3 – 数据包格式 121 – 的版本均可被检测,但随着 Minecraft 的进一步更新,这将迅速扩展。

Please report any issues you have with wrong versions or any other unexpected behaviour on GitHub. Thank you!
VerSion
In Minecraft Vanilla, there is no simple command (or any source, that is) providing the currently running Minecraft Version or data pack format to datapacks.
VerSion addresses this issue and may be used as an API by other datapacks to get the current pack format. Using overlays, VerSion achieves this goal in an inexpensive, light-weight and future-proof manner.
In contrast to existing alternatives (like Version Detector, which at least supports earlier versions), VerSion covers way more formats, does not throw faulty errors (when in reality, everything's working) or display excessive amounts of notices, and thus may be used elegantly and in any form of datapack project you plan to implement. Of course, it is free of charge and open-source forever.
How to use
Functions:
function ver:sion, returns current pack format as an int (available 23w44a and later)function ver:loadto reload version info (runs automatically on world startup and/reload)function ver:printto print current version info to the executor
On every reload, VerSion stores the current pack format as an Integer and the name of the (last) Minecraft version using that format as a String inside a data storage. If lost, this information may always be refetched by running /function ver:load.
#get the pack format
data get storage ver:sion Format
#get the version
data get storage ver:sion Name
To make use of that information in your pack, use execute store ... run data get storage ver:sion Format or data modify ... from storage ver:sion (Format|Name).
For formats beginning with 23 (versions 23w44a and later), the most convenient way to get the pack format is function ver:sion which simply returns the current pack format.
Supported versions
If the datapack is marked as being for an older/newer version when investigated, that means no correct version info will be supplied. Due to the way VerSion works out the current pack format, only version 1.20.2 and later (specifically, beginning 23w31a) may be detected. For simplicity, only the major format number is taken into account.
Currently, all versions up to 26.3 – pack format 121 – are detected, however this will be quickly expanded when Minecraft updates progress further.
下载 VerSion
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 VerSion
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 VerSion
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
更新日志
破坏性更改!
- 版本信息现在存储在
storage ver:sion CurrentFormat(格式)字段现在是Current.data_pack_versionName(名称)字段现在是Current.name
- VerSion 现在由 beet 构建
- 除了覆盖层(overlays),现在提供了一种更稳健的方法,在任意玩家在线时提供_确切_的版本信息
- 如果没有玩家在线,仍将使用覆盖层;但如果数据包格式是唯一的,仍会提供精确对应的版本信息
- misode/mcmeta 中存在的版本数据现在将提供给所有数据包,包括当前资源包格式、协议版本、SHA 等。
- 新增对 26.4-snap3 的支持
- 最低支持版本仍为 23w31a
修复
- 对于旧版 文本组件格式(即低于 1.21.5 的版本),
function ver:print不可用
提交记录更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
数据包
此数据包添加了属于阿瓦里海盗的独特结构,将他们的独特风格带入你的 Minecraft 世界!兼容性:1.20 至 26.3
数据包
一个 Minecraft 光线投射库,能够精确检测玩家正在查看的方块,包括像台阶和楼梯这样的特殊方块形状。
数据包
此数据包添加了新的“祝福模式”难度。
数据包
允许服务器管理员方便地禁用 Xaero's Map 系列模组中的实体雷达、小地图等功能,使竞技游戏更加公平。
数据包
使用原版/生存友好的方法更改青蛙的变种类型。支持原版(寒冷、温带、温暖)以及可选的“More Frogs 2”变种:深红、末影、地狱、毒镖、紫珀、幽匿、灵魂、诡异和木头。
数据包
手持潜影盒时可直接打开,无需将其放置在地面上。只需按住 Shift 并右键点击即可访问你的潜影盒。
评论 0
登录后参与评分
还没有评论,来抢沙发吧