跳到正文

xzutils

作者:xokz

Useful and obscure. Provides enchantment reformatting for data manipulation.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

XZUtils

XZUtils is a library designed to aid datapack developmnent in niche ways.

Functions

Enchantment Data Restructuring

Enchantment data is stored in items like so:
{id:level,id:level}
This is difficult to work with. This outputs a copy formatted as [{id:<name>,level:<value>},{id:<name>,level:<value>}] for easy enchantment manipulation.

ie;
{"minecraft:sharpness":5,"minecraft:looting":2}
converts to
[{"id":"minecraft:sharpness","level":5},{"id":"minecraft:looting","level":2}]

USAGE:

  1. in storage, set xzu:temp in to your enchantment map.
  2. run function xzu:enchant/build_enchantment_map/main
  3. your formatted map is located in xzu:temp out

Example:

# put enchantments from players held item in storage input
data modify storage xzu:temp in set from entity @p SelectedItem.components."minecraft:enchantments"

# convert map
function xzu:enchant/build_enchantment_map/main

# see formatted data
data get storage xzu:temp out

NOTE:
This requires 0 0 to be chunkloaded, and will set 0 0 0 to be air. XZUtils handles this automatically, but there will be an air block at 0 0 0 every time this function is used.

常见问题

xzutils 支持哪些 Minecraft 版本?

xzutils 支持 Minecraft Java 版 1.21.5–1.21.11,共 7 个版本。下载时注意选择和你游戏版本一致的文件。

xzutils 怎么安装?

新建世界时在「数据包」里把下载的 .zip 拖进去;已有的存档,把文件放进存档目录下的 datapacks 文件夹,进游戏输入 /reload 即可生效。服务器同样放在世界目录的 datapacks 里。

评论

登录后评论和评分

xokz 的其他作品

查看全部 →