xzutils

Useful and obscure. Provides enchantment reformatting for data manipulation.

10

Quick challenge

How far can you run before the mobs catch you?

xzutils

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.

ADS